about the function parameters

Discussion in 'C Programming' started by apporc, Dec 31, 2010.

  1. apporc

    apporc Guest

    A:
    int main(argc,argv)
    int argc;
    char* argv[];
    {...}

    B:
    int main(int argc,char* argv[])
    {....}

    Is there something different between A and B?
    Thanks.
     
    apporc, Dec 31, 2010
    #1
    1. Advertising

  2. apporc

    Seebs Guest

    On 2010-12-31, apporc <> wrote:
    > A:
    > int main(argc,argv)
    > int argc;
    > char* argv[];
    > {...}


    > B:
    > int main(int argc,char* argv[])
    > {....}


    > Is there something different between A and B?


    Yes, the second is a function prototype. For these *particular* types,
    they happen to have roughly the same effect, but for some other types
    (e.g., float), they wouldn't.

    Use the second form.

    -s
    --
    Copyright 2010, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
    I am not speaking for my employer, although they do rent some of my opinions.
     
    Seebs, Dec 31, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jonck van der Kogel
    Replies:
    2
    Views:
    1,008
    Jonck van der Kogel
    May 27, 2004
  2. Boris Sargos
    Replies:
    3
    Views:
    424
    Boris Sargos
    Apr 23, 2004
  3. Jason
    Replies:
    2
    Views:
    555
    Jonathan Mcdougall
    May 13, 2006
  4. kito
    Replies:
    2
    Views:
    439
  5. Florian Loitsch
    Replies:
    11
    Views:
    263
    Michael Winter
    Mar 15, 2005
Loading...

Share This Page