bsc

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

luc046.c (865B)


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