#include <stdio.h>
void circle(int *,int *,int *);
int main() {
int x,y,z;
printf("please enter 3 numbers = ");
scanf("%d %d %d",&x,&y,&z);
circle(&x,&y,&z);
printf("x=%d y=%d z=%d",x,y,z);
}
void circle(int *a,int *b ,int *c) {
int *d;
d=*a;
*a=*b;
*b=*c;
*c=d;
}
The above code is for circularly exchanging the values of x, y, z
using functions.
In the above code I have used *d
or d
is an unsigned
integer, still if in
d=*a
if x
(or a
) = -1
then also the code works.