C Programming and Technical

Q. Predict the output or error

A. main()
{
main();
}

A. Runtime error : Stack overflow.

Explanation: main function calls itself again and again. Each time the function is called it's return address is stored in the call stack. Since there is no condition to terminate the function call, the call stack overflows at runtime. So it terminates the program and results in an erro

Read Solution (Total 0)

C Other Question

Q. what will be the position of the file marker?
a: fseek(ptr,0,SEEK_SET);
b: fseek(ptr,0,SEEK_CUR);

A. a: The SEEK_SET sets the file position marker to the starting of the file.
b: The SEEK_CUR sets the file position marker to the current position
of the file.
Q. Predict the output or error
main()
{
int i=5,j=6,z;
printf("%d",i+++j);
}

A. 11

Explanation:the expression i+++j is treated as (i++ + j)