
- Forum
- Programming Talk
- C and C++
- Confused With Error
Confused With Error
This is a discussion on Confused With Error within the C and C++ forums, part of the Programming Talk category; My C program is as below: main() { x() { t() { printf("Hello"); } printf("Welcome"); } printf("Bye"); } When I ...
-
Confused With Error
My C program is as below:
main()
{
x()
{
t()
{
printf("Hello");
}
printf("Welcome");
}
printf("Bye");
}
When I compiled my program I got error instead of the output getting printed as Hello Welcome Bye. Why is it so? Kindly explain me on this.
-
You would have got the error as Statement missing ; in function main. Am I right? So you would be thinking whether you have missed any ;. But the error message does not indicate that. It denotes that one must not define another function within the body of another function. In your program you have defined function x() and t() inside main() which gives you error. Define that outside the function main and call the function inside main() your problem would be resolved.
-
You would have got the error as Statement missing ; in function main. Am I right? So you would be thinking whether you have missed any ;. But the error message does not indicate that. It denotes that one must not define another function within the body of another function. In your program you have defined function x() and t() inside main() which gives you error. Define that outside the function main and call the function inside main() your problem would be resolved.
-
Sponsored Ads

Reply With Quote





