|
-
November 9th, 2011, 01:20 PM
#1
Swapping function not working!
Can someone tell me whats wrong with these codes?
Why x and y couldnt be swap?
#include <stdio.h>
void swap (int x, int y);
int main()
{
int x, y;
x=3;
y=4;
swap(x, y);
printf("X is %d\n", x);
printf("Y is %d\n", y);
return 0;
}
void swap(int x, int y)
{
int temp;
temp= x;
x=y;
y=temp;
return;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|