int main parameters

This is a discussion on int main parameters within the C++ Programming forums, part of the General Programming Boards category; Hello, Code: int main(int argc, char **argv) Does this mean int main takes two parameters argc and double(?)pointer argv? What ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Jacksonville, AR
    Posts
    91

    Question int main parameters

    Hello,

    Code:
    int main(int argc, char **argv)
    Does this mean int main takes two parameters argc and double(?)pointer argv? What does double pointer mean? Does that pertain to an array?
    Is this used when your program uses a function from the compiler package?

    Thanks!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,265
    Read the tutorial on accepting command line arguments.

    Quote Originally Posted by alyeska
    What does double pointer mean?
    Pointer to a pointer. The tutorial uses slightly different syntax but it means the same thing.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    a newbie :p
    Join Date
    Aug 2008
    Location
    Zurich, Switzerland, Switzerland
    Posts
    91
    I guess it is not an ordinary ptr-to-ptr. It is special: a special issue for argument.
    Check here:
    http://www.codeproject.com/KB/cpp/PtrToPtr.aspx
    Last edited by auralius; 01-13-2009 at 04:58 AM.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    No, it's not special. It's an ordinary pointer to pointer. You just interpret both pointees as arrays. But that's not particularly special.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    a newbie :p
    Join Date
    Aug 2008
    Location
    Zurich, Switzerland, Switzerland
    Posts
    91
    yup, you're right...
    my mistake...


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 11-30-2007, 03:51 AM
  2. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  3. Replies: 4
    Last Post: 11-23-2003, 07:15 AM
  4. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM

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