Home > Back-end >  Urgent urgent,
Urgent urgent,

Time:09-17

This what wrong ah, have without bosses to solve!!!!!!

CodePudding user response:

Swap not declare, your function?

CodePudding user response:

Put your swap function int main () to the front,

Or, as the upstairs said, in the int main () with a disclaimer:

Void swap (int * p_1, p_2 int *)

Also, when you swap function has no return value, best and void,

CodePudding user response:

Upstairs said is truth, if you don't forward declaration function, is going to put it in front of the main ()

CodePudding user response:

Line 14 to 20 rows to the back of the line 1

CodePudding user response:

 # include & lt; Stdio. H> 
Void swap (int * p_1, p_2 int *);//-- -- -- -- -- - add swap () function statement -- -- -- -- -- -- -- -- --
Int main ()
{
Int a, b;
P1, int * * p2.
The scanf (" % d % d ", & amp; A, & amp; B);//-- -- -- -- -- - don't have a comma between two % d -- -- -- -- -- -- -- -- --
P1=& amp; a;
The p2=& amp; b;
If (a & gt; B)
{
Swap (p1, p2);//-- -- -- -- -- - pay attention to the function of the parameter type is a pointer, * (p1 and p2 to p1 and p2 - -- -- -- -- -- -- -- -- -- --
}
Printf (" % d, % d \ n ", * (p1, * (p2);
Printf (" % d, % d \ n ", a, b);
return 0;
}

Void swap (int * p_1, p_2 int *)
{
Int p;
P=* p_1;
* p_1=* p_2;
* p_2=p;
}

C + + environment debugging VS2015