Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Comment on the output of the following C code.
#include < stdio.h >
int main()
{
int i;
for (i = 0;i < 5; i++)
int a = i;
printf(“%d”, a);
}

Comment on the output of the following C code.
#include < stdio.h >
int main()
{
int i;
for (i = 0;i < 5; i++)
int a = i;
printf(“%d”, a);
}
a) a is out of scope when printf is called
b) Redeclaration of a in same scope throws error
c) Syntax error in declaration of a
d) No errors, program will show the output 5

Answer: c

Join The Discussion