You are here:

C/the main( ) function parameters

Advertisement


Question
Hi,
   I just hope you can help me clear things out regarding the parameters in the function main() in C. It goes more likely as this :
   int main (int arcg, char *argv[]){}
Where can we do the passing of parameters to function main()?
   I just for your clearer response. Thank you and more power.

Deep Xavier  

Answer
When you compile your C program, it gets linked to a library, which contains the startup routine. This startup routine is the one which calls the main() function. main() function is the entry point into the program. So, if you miss out the main() function, you will get linking error!

So, you need not call main() function.
But, if you call your main() function from your program, then there are chances of it going to infinite loop, unless care is taken.

-ssnkumar

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.