main() with arguments?

This is a discussion on main() with arguments? within the C Programming forums, part of the General Programming Boards category; Hello! I am taking steps now to learn C thoroughly since you encouraged me to do so. Thanks. Now I ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    26

    main() with arguments?

    Hello!

    I am taking steps now to learn C thoroughly since you encouraged me to do so. Thanks. Now I have some questions for you. I see in most of the programs that main has no any arguments or parameters. Are there any occasions when main() should have some parameters except void?

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    12
    Yes there is some instancess where you have to. check this out http://faq.cprogramming.com/cgi-bin/...&id=1043284376

  3. #3
    ---
    Join Date
    May 2004
    Posts
    1,379
    Code:
    int main(int argc, char* argv[])
    {
      return 0;
    }
    they are command line paramaters

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Too many arguments to function int main?
    By plain in forum C++ Programming
    Replies: 13
    Last Post: 08-29-2006, 06:01 PM
  2. Actient main
    By swgh in forum C Programming
    Replies: 2
    Last Post: 03-21-2006, 12:33 PM
  3. C99 and int main()
    By cwr in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 06:54 AM
  4. Passing arguments to main?
    By xddxogm3 in forum C++ Programming
    Replies: 4
    Last Post: 10-16-2003, 03:59 AM
  5. arguments passed to main?!?
    By threahdead in forum C++ Programming
    Replies: 14
    Last Post: 01-22-2003, 07:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21