Showing posts with label Macro. Show all posts
Predict the Output

Predict the Output

#define tech(a,b) a##b##a int main() { if(printf("%d",tech(4,0))) { } return 0; } Output: 404 Read about Macro
Read More
70

70

#define les(a,b)     a<b?a:b int main() { int i=1,j=3,k; k=les(i++,++j); printf ("%d %d %d",i,j,k); return 0; } Output: 3...
Read More
61

61

Predict the output: int main() { struct shark { int b; #define selva() b }s; s.selva() =4; printf ("%d",s.b); return 0; }...
Read More
58

58

#define ft(a,b) (a)*b int main () { printf ( "%d" , ft(2+1,3+1 ); return 0; } Output: 10 Logic: function is replaced with const...
Read More
56

56

In the following program which one will run without any errors?: #define a 2 int main() { int b=2; switch(b) { case a: printf("%d"...
Read More
50

50

#ifdef NULL #define NULL 2 #endif #ifndef NULL #define NULL 4 #end if int main() { printf("%d",++NULL^NULL|0); return 0; } Output:...
Read More
49

49

#define shark(a,e,i,o,u,s,r) u##r##i##e #define srini shark(z,n,i,t,m,k,a) int srini(int a) { printf("%d",a); return 0; } int main...
Read More
46

46

#define float char int function(char a) { if(a return function(a+8); printf("%c",a+32); return 0; } int main() { float b='\n...
Read More
36

36

#define max 4 int main() { int i; for(i=0;i { printf("%d",i); max=max+i; } } Output compilation Error.
Read More
35

35

#define s(b) b*2-1 int main() { printf("%d",s(3)*2); return 0; } Output: 4
Read More
29

29

#includedeny stdio.h > #define shark(s) printf("%d",s); #define srini(b) b-1 int main() { shark(2*srini(2)) } Output: 3
Read More