/* Write a C program that takes three variables (a, b, c) in as separate parameters and rotates the values stored so that value a goes to b, b, to c and c to a. */ #include #include void main() { int a,b,c; void rotate(int*,int*,int*); clrscr(); printf("Enter three integers: "); scanf("%d %d %d",&a,&b,&c); printf("\n\nVariables as given: a=%d, b=%d, c=%d",a,b,c); rotate(&a,&b,&c); // Function call by reference printf("\n\nVariables after 1st rotation: a=%d, b=%d, c=%d",a,b,c); rotate(&a,&b,&c); // Function call by reference printf("\n\nVariables after 2nd rotation: a=%d, b=%d, c=%d",a,b,c); rotate(&a,&b,&c); // Function call by reference printf("\n\nVariables after 3rd rotation: a=%d, b=%d, c=%d",a,b,c); } void rotate(int *a,int *b,int *c) { //swap values between 'a' & 'c' *a = *c^*a; *c = *c^*a; *a = *c^*a; //swap values between 'b' & 'c' *b = *c^*b; *c = *c^*b; *b = *c^*b; return; }