Discussion :: C-MCQs
-
What is the output of this C code?
int main()
{
printf("Hello World! %d \n", x);
return 0;
}
Answer : Option C
Explanation :
It results in an error since x is used without declaring the variable x.
Output:
$ cc pgm1.c
pgm1.c: In function 'main':
pgm1.c:4: error: 'x' undeclared (first use in this function)
pgm1.c:4: error: (Each undeclared identifier is reported only once
pgm1.c:4: error: for each function it appears in.)
Be The First To Comment