What will be the output of the following C code?
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
retum 0;
a. Hello World! 34
-b. Hello world! followed by a junk value
Oc Compile time error
d
Hello World! 1000
Answers
Answered by
1
Answer: :c) Compile time error
Explanation
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
Follow me
mark me as briliant
please my friend :)
Similar questions