Tuesday, May 26, 2009

State the output

#include
int a = 20;
void main()
{
fun1();
printf(" ");
fun1();
printf(" ");
fun1();
printf(" ");
}

fun1()
{
static int b = 10;
b++;
printf("%d", b++);
b=12;
printf(" ");
printf("%d", b++);
}

A 10 12 10 12 10 12
B 11 12 11 12 11 12
C 11 12 14 12 14 12
D Error "static variable re-assignment"

No comments: