Discussion :: C-MCQs
-
What is the output of this C code?
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
Answer : Option A
Explanation :
Since y is already defined, redefining it results in an error.
Output:
$ cc pgm2.c
pgm2.c: In function 'main':
pgm2.c:5: error: redefinition of 'y'
pgm2.c:4: note: previous definition of 'y' was here
Be The First To Comment