Results 1 to 4 of 4

Thread: Can void be the return value of main Function

  1. #1
    Contributing Member
    Join Date
    May 2006
    Answers
    72

    Question Can void be the return value of main Function

    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.


  2. #2
    Expert Member
    Join Date
    May 2006
    Answers
    114

    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.


  3. #3
    Contributing Member
    Join Date
    May 2006
    Answers
    72

    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.


  4. #4
    Junior Member
    Join Date
    Jul 2007
    Answers
    9

    Re: Can void be the return value of main Function

    void main() works in the TC compiler but not in cc. why?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact