0% found this document useful (0 votes)
43 views1 page

Conundrums

This document contains 7 coding problems with snippets of C code. It challenges the reader to predict the output of each program and email the correct answers along with explanations to win a surprise gift. The solutions will be posted on a blog the following month.

Uploaded by

api-3705912
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Conundrums

This document contains 7 coding problems with snippets of C code. It challenges the reader to predict the output of each program and email the correct answers along with explanations to win a surprise gift. The solutions will be posted on a blog the following month.

Uploaded by

api-3705912
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

‘C’onundrums

-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

You might also like