Conundrums
Conundrums
-Crack them…
1>
#define SIZE 10 4>
void size(int arr[SIZE]) int main()
{ {
printf("size of array int cnt = 5, a=15000;
is:%d\n",sizeof(arr)); do
} {
int main() a /= cnt;
{ } while(cnt--);
int arr[SIZE];
size(arr); printf ("%d\n", a);
return 0; return 0;
} }
2> 5>
int main() int main()
{ {
int a=3, b = 5; int i = 10;
printf(&a["Ya!Hello! how is this? %s\n"], printf("i : %d\n",i);
&b["junk/super"]); printf("sizeof(i++) is:
printf(&a["WHAT%c%c%c %c%c %c ! %d\n",sizeof(i++));
\n"], printf("i : %d\n",i);
1["this"],2["beauty"],0["tool"],0["is"],3["sensi }
tive"],4["CCCCCC"]);
return 0; 6>
} main()
{
3> int *ptr=(int*)malloc(sizeof(int));
#define PrintInt(expr) printf("%s : *ptr=4;
%d\n",#expr,expr) printf("%d\n",(*ptr)+++*ptr++);
int main() printf("%d",*ptr);
{ }
int y = 100;
int *p; 7>
p = malloc(sizeof(int)); main()
*p = 10; {
y = y/*p; /*dividing y by *p */; int a=1,b=3,c,d;
PrintInt(y); c=(a,b);
return 0; d=a,b,c;
} printf("%d %d",c,d);
}
Predict the output for the above programs. Be the First one to mail the correct answers along with apt
reasons and win a surprise gift…!!!
For solutions check our blog next month
Sandeep dadwal
3rd year