Ask Experts Questions for FREE Help !
Ask
    demar123's Avatar
    demar123 Posts: 1, Reputation: 1
    New Member
     
    #1

    Jan 20, 2011, 12:24 PM
    C programming
    What does main (void) really means, and the purpose of it
    rpray2007's Avatar
    rpray2007 Posts: 319, Reputation: 23
    Full Member
     
    #2

    Jan 21, 2011, 11:56 AM
    I believe it means that you are effectively not returning anything when a function returns void. Void is an empty data structure that does not have any memory allocated to it.
    WildProgrammer's Avatar
    WildProgrammer Posts: 5, Reputation: 1
    New Member
     
    #3

    Oct 1, 2012, 10:12 AM
    Hello!

    main is the principal structure of any C++ program it normaly have 3 part, usually you will see it like this

    int main(void)
    {
    your code here
    return 0
    }

    -The first part int tell that the main function will return a integer in most case 0 is the return value witch just mean that every thig have work wright but it can also be a other value if a error have occur and your error handling code can use it to return a other value can be useful for deboging reason for example.

    - The main part is the main part of your code it is where you will call all your function, it is usually the entry point of your program.

    - Now the (void) part it simply mean that your program will not take any argument on is command line when you start your program.

    For example you want a program that can take a integer as you start it like
    this:

    PROGRAM.EXE 234

    the structure for your program to accept this value and use it your code will be
    something like this

    int main(int YourVariableName)
    {
    HERE YOUR CODE HAVE ACCESS TO YourVariableName
    }


    Hope this was helpful

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Something about programming! [ 4 Answers ]

Can anyone help me about this question>>>?? (Microsoft Visual C++) A company wants to transmit data over the telephone, but they are concerned that their phones may be tapped. All of their data is transmitted as four-digit integers. They have asked you to write a program that will encrypt their...

Programming a t.v. [ 1 Answers ]

I bought a vizio t.v. and was wondering if anyone could tell me how to programming a direct t.v. remote to the television because it's not listed on the programs:confused:

Qt programming [ 1 Answers ]

Hi, My name is anshahmed.I am doing final year B.TECH.Now I am doing a project and I want to use qt programming .Whie I was compiling the qt programm the compiler giving errors in header file(qpplicaton.h) .how can I compile the qt programm.


View more questions Search