Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > about the function parameters

Reply
Thread Tools

about the function parameters

 
 
apporc
Guest
Posts: n/a
 
      12-31-2010
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.
 
Reply With Quote
 
 
 
 
Seebs
Guest
Posts: n/a
 
      12-31-2010
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 / usenet-
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class Member Data and Member Function Parameters - Should Parameters Be Data Members? Jason C++ 2 05-13-2006 07:11 AM
function pointers as function parameters Marlene Stebbins C Programming 27 05-16-2005 12:01 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Are default function parameters in allowed in function templates? BRG C++ 11 01-04-2005 02:48 PM
restriction of a two-parameters function to a one-parameter function Boris Sargos C++ 3 04-23-2004 04:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57