Default int main arguments in C/C++

Discussion in 'Mac Programming' started by sheepopo39, Dec 9, 2009.

  1. sheepopo39 macrumors 6502

    Joined:
    Sep 18, 2008
    #1
    I was messing around with projects in xcode with C/C++ and I notcied this

    Code:
    #include <iostream.h>
    
    int main (int argc, const char * argv[]) {
        // insert code here...
        cout << "Hello, World!\n";
        return 0;
    }
    
    C++

    and

    Code:
    #include <stdio.h>
    
    int main (int argc, const char * argv[]) {
        // insert code here...
        printf("Hello, World!\n");
        return 0;
    }
    
    C

    So I've always sort of wondered about this, what exactly do those default arguments do in C/C++ under int main? I know that the application will still compile without them, but what purpose do they serve?
     

Share This Page