Showing posts with label game. Show all posts
Showing posts with label game. Show all posts

C Puzzles

0 comments Posted by Unknown at 18:42

Interview Questions

Write the output of this program
#include
main()
{
int *a, *s, i;
s = a = (int *) malloc( 4 * sizeof(int));
for (i=0; i<4; i++) *(a+i) = i * 10;
printf("%d\n", *s++);
printf("%d\n", (*s)++);
printf("%d\n", *s);
printf("%d\n", *++s);
printf("%d\n", ++*s);
}
Checkout this program result
#include
void fn(int);
static int val = 5;
main()
{
while (val --) fn(val);
printf("%d\n", val);
}
void fn(int val)
{
static int val = 0;
for (; val < 5; val ++) printf("%d\n", val);
}
Read More »
 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top