yes, there will be times when your program needs to know the  number of 
command line arguments and what they are. When that is the case, you  can 
define 
main differently.
 
int main(int argc, char *argv[ ]) {
 
so argc is the number of command line arguments and argv will  hold the 
actual command line arguments. 
 
btw, argv[0] is always the name of the program executable  itself.
 
 
In a message dated 4/7/2009 9:57:06 A.M. Eastern Daylight Time,  
[email protected] writes:

 
 
 
I've also seen int main(void)
I believe that's just for arguments sake  though, so the OS won't pass in 
anything on the stack, though I'm not really  sure.

Thanks,
Tyler Littlefield
Web: tysdomain.com
email: [email protected]_ (mailto:[email protected]) 
My  programs don't have bugs, they're called randomly added features.

-----  Original Message ----- 
From: _cupofjava1...@cupofja_ (mailto:[email protected])  
To:  [email protected]_ (mailto:[email protected])   
Sent: Tuesday, April 07, 2009 7:23 AM
Subject: Re: [c-prog] C  language

The main function returns an integer to the operating system  indicating the 
success or failure of the program. You should code int  main( ).
I've actually seen void main(void) in C textbooks, and yes it will  work, but 
technically it is incorrect to do so, because the operating  system is 
expecting an integer to be returned from your C program.  

************************<WBR>**A Good Credit Score is 700 or Above. See yours 
in
steps! 
(_http://pr.atwola.http://pr.atwhttp://pr.atwolahttp://pr.atwolahttp://pr.http
://prhttp://pr.atwolahttp://pr.ahttp://pr.atwolhttp://pr.http://prhttp://p_ 
(http://pr.atwola.com/promoclk/100126575x1221421323x1201417385/aol?redir=http://
www.freecreditreport.com/pm/default.aspx?sc=668072&hmpgID) 
%3D62%26bcd%%3D62%26bcd%<WBR%3

[Non-text  portions of this message have been removed]

[Non-text portions of this  message have been removed]





**************Worried about job security? Check out the 5 safest jobs in a 
recession. 
(http://jobs.aol.com/gallery/growing-job-industries?ncid=emlcntuscare00000003)


[Non-text portions of this message have been removed]

Reply via email to