|
Swap using Pointers
This example shows swap using pointers.
04 | void swap( int *a, int *b) |
06 | *a ^= *b, *b ^= *a, *a ^= *b; |
09 | int main( int argc, char *argv[]) { |
13 | printf ( "x=%d y=%d" ,x,y); |
16 | printf ( "\nx=%d y=%d" ,x,y); |
|
It gives the following output,
x=6 y=2
x=2 y=6
|
|