Variable Names – 2.Image.Marked.pdf


Preview of PDF document variable-names-2-image-marked.pdf

Page 1 2 3 4 5 6 7

Text preview


int y = 10000;

int y = 34;

printf("Hello World! %d\n", y);

return 0;

}

a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value
View Answer
Answer:a
Explanation:Since y is already defined, redefining it results in an error.
Output:
$ cc pgm2.c
pg

. : I fu tio

ai :

pg

. : : e o : edefi itio of

pg

. : : ote: p e ious defi itio of

as he e

4. Which of the following is not a valid variable name declaration?
a) float PI = 3.14;
b) double PI = 3.14;