Predict the output or error(s) for the following:
1. void main()
{
}
Answer:
Compiler
error: Cannot modify a constant value. Explanation:
p is a pointer to a "constant integer". But we
tried to change the value of the "constant integer".
2. What is the output of this C code?
a) Compile time error
b) Hello is printed thrice
c) Nothing
d) Varies
b) Hello is printed thrice
c) Nothing
d) Varies
Answer:a
3. What is the output of this C code?
a) Run time error
b) Hello is printed thrice
c) Hello is printed twice
d) Hello is printed infinitely
b) Hello is printed thrice
c) Hello is printed twice
d) Hello is printed infinitely
Answer:b