Friday, December 5, 2008

What is the output of following programme ?

int main()
{
int a[5]={0,1,2,3,4,5};
unsigned int b = 0xffffffff;
a[b] = 30;
printf("%d\n", a[-1]);
a[-1] = 50;
printf("%d %d\n", a[-1],b);
}

a. Error
b. Garbage Garbage 1
c. 30 50 -1
d. -30 -50 1
e. None of the above

No comments: