Showing posts with label macros. Show all posts
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
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
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
23

23

#include #define merge(a,b) a##b main() { int c=merge(4,0); c=c+1; printf("%d",c); return 0; } Output: 41 Logic: in previous post ...
Read More
15

15

#include #define a 4 main() { a++; printf("%d",a); } output Compilation Error: Lvalue Required. How? #define defines a co...
Read More
14

14

#include #define a (5+2) main() { int c; c=2*a; printf("%d",c); } Output 14 how? as said in last post the variable defined using m...
Read More
13

13

#include #define a 3+2 main() { int b; b=a*2; printf("%d",b); } click Output How? #define is used to define a constant. in this pr...
Read More
#define  Macroprocessor

#define Macroprocessor

One of macroprocessor #define used to define value for variable. The value will be constant for that variable. Can't change in run time...
Read More