Error: Id returned 1 exit status (undefined reference to 'main')
As we know that,
- Each program must have a main() function, compiler starts execution from the main() function - main() is an entry point to the program,
- And, the second this "C language is a case-sensitive language - uppercase words, and lowercase words are different".
This error is occurred on following cases,
- If main() is not written in lowercase, like you used Main(), MAIN(), mAin() or anything else.
- If main() does not exist in the program or by mistake you mistyped the main().
Consider the programs...
Program 1) 'main()' is not in lowercase
Output
Program 2) Mistyped 'main()' as 'nain()' or anything else
Output
How to fix?
To fix this error - use correct syntax of main() i.e. use main(), type correct spelling in lowercase
Correct code:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer