Prepare for your Next Interview
This is a discussion on Can void be the return value of main Function within the C and C++ forums, part of the Software Development category; Is it possible to declare the main() as void. Will this declaration of main function as void give me error? Someone who has experienced throw highlight on this....
|
|||
|
Is it possible to declare the main() as void. Will this declaration of main function as void give me error? Someone who has experienced throw highlight on this.
|
| Sponsored Links |
|
|||
|
Re: Can void be the return value of main Function
It is not possible to declare main() function return value as void. This is because the default return value of main function in C is int and if one declares it as void it results in mismatch in declaration and so cannot be declared as void.
|
|
|||
|
Re: Can void be the return value of main Function
It was a nice explanation so is it that if one declare void in main() the program would throw redeclaration error that is a compile time error.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Return Value of Functions | janelyn | C and C++ | 3 | 09-24-2007 02:09 AM |
| Usage of function | janelyn | C and C++ | 2 | 11-12-2006 03:11 PM |
| Type of Error for Variables not declared in function | fred | C and C++ | 1 | 07-12-2006 05:31 PM |
| WebSphere V5.0 : Use search function | Lokesh M | Web Tools | 0 | 06-02-2006 09:15 AM |