bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc046.c

luc046.c (729B)


      1 /* Given three variables x, y, z, write a function to circularly shift their
      2 values to right. In other words, if x = 5, y = 8, z = 10, after circular
      3 shift y = 5, z = 8, x = 10. cal the function with variables a, b, c to
      4 circularly shift values.
      5 */
      6 /* Let Us C, Chap- 9, Page - 163, Qn No.: C(a) */
      7 
      8 #include <stdio.h>
      9 
     10 void circularShift(int *, int *, int *);
     11 
     12 int main()
     13 {
     14     int x = 5, y = 8, z = 10;
     15 
     16     printf("--- Before Shift ---\n");
     17     printf("x: %d, y: %d, z: %d", x, y, z);
     18 
     19     circularShift(&x, &y, &z);
     20 
     21     printf("\n--- After Shift ---\n");
     22     printf("x: %d, y: %d, z: %d", x, y, z);
     23 
     24     return 0;
     25 }
     26 
     27 void circularShift(int *x, int *y, int *z)
     28 {
     29     int temp = *z;
     30     *z = *y;
     31     *y = *x;
     32     *x = temp;
     33 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror