616 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
327 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,486 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
SSR17 asked Feb 29
204 views
#include <stdio.h int main() { int i = -1; int x = (unsigned char)i; printf("%d", x); return 0; }output is 255 , but please explain how
2 votes
2 votes
1 answer
4
rupamsardar asked Aug 30, 2023
468 views
#include <stdio.h int f(int x) { if(x%2==0) { return f(f(x-1)); } else return (x++); } int main() { printf("%d",f(12)); ret...