Join ExamsbookAnswer :
Point out the error, if any, in the following program.
main()
{
int a = 10;
void f();
a = f();
printf ( "\n %d", a );
}
void f()
{
printf ( "\n Hi ");
}5
Q: Point out the error, if any, in the following program. main() { int a = 10; void f(); a = f(); printf ( "\n %d", a ); } void f() { printf ( "\n Hi "); }
- Show AnswerHide Answer
- Workspace
Answer :
Explanation :
In spite of defining the function f() as returning void, the program is trying to collect the value returned by f() in the variable a.