627 views
0 votes
0 votes

Can someone explain how the output is derived for the second printf statement.
I have not understood how the value of x changed to 13 instead of 10. Detailed step by step explanation please.

 

    #include <stdio.h>
    #define f(a,b) a+b
    #define g(a,b) f(a,b)/f(a,b)
     
    int main(){
        int x=4;
        g(x,x+1);
        printf("%d\n",x);
        x=g(x,x+1);
        printf("%d",x);
        return 0;
    }

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
aditi19 asked Sep 3, 2018
349 views
tokens passed to macros are treated as int, float or string?
2 votes
2 votes
1 answer
2
sid1221 asked Jul 18, 2017
1,533 views
# include <stdio.h># define scanf "%s GeeksQuiz"int main(){ printf(scanf, scanf); return 0;}(A) Compiler Error(B) %s Geeks Quiz(C) Geeks Quiz(D) %s Geeks Quiz Geeks ...
0 votes
0 votes
1 answer
3
Debargha Mitra Roy asked Apr 16
78 views
#include <stdio.h int main() { int a[3] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; }(Assume size of int to be $2$ bytes.)T...