bsc

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

external_7.c (524B)


      1 // 7. Write a program to swap two numbers using a macro.
      2 
      3 #include<stdio.h>
      4 
      5 #define SWAP(a, b)              	   \
      6         do {                           \
      7             __typeof__(a) temp = a;    \
      8             a = b;              	   \
      9             b = temp;           	   \
     10         } while (0)             	   \
     11 
     12 int main() {
     13     int a, b;
     14     printf("Enter two number: ");
     15     scanf("%d %d", &a, &b);
     16     printf("\nA = \'%d\', B = \'%d\'", a, b);
     17     SWAP(a, b);
     18     printf("\nA = \'%d\', B = \'%d\'", a, b);
     19     return 0;
     20 }
© 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