Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program? #include<stdio.h> #define SWAP(a, b) int t; t=a, a=b, b=t; int main() { int a=10, b=12; SWAP(a, b); printf("a = %d, b = %d\n", a, b); return 0; } ?->(Show Answer!)
1. What will be the output of the program? #include<stdio.h> #define SWAP(a, b) int t; t=a, a=b, b=t; int main() { int a=10, b=12; SWAP(a, b); printf("a = %d, b = %d\n", a, b); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.00 pm
The macro SWAP(a, b) int t; t=a, a=b, b=t; swaps the value of the given two variable. Step 1: int a=10, b=12; The variable a and b are declared as an integer type and initialized to 10, 12 respectively. Step 2: SWAP(a, b);. Here the macro is substituted and it swaps the value to variable a and b. Hence the output of the program is 12, 10.