Re: main(int argc, char *argv[])
- From: "Emmanuel Delahaye" <emdel@xxxxxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 16:18:39 +0200
(supersedes <mn.f3d17d544d971c16.15512@xxxxxxxxxxxxxx>)
Sokar wrote on 29/04/05 :
I have my main function set up as
int main(int argv, char *argv[])
so taht i can read in a variable which is passed to the program on the command line. The problem is that main calls other functions and some of them need to start jump to the start of main. If my main setup was just int main() this would be no problem, i could just call main();
The problem is main needs parameters passed to it now. Would any1 know what parameters I could pass to vall the main program??
argv[1] is just used once as soon as main starts up and never used again after, so i dont mind if i loose the ability to read from it, i just need to be able to call main from another part of the program
Thanks and regards
Why in the world do you have to call main() ? While it is technically possible in C (but not in C++, for good reasons, I guess), it exposes a design error. There are enough code structure in C to avoid that.
- functions - while - do-while - for
Write a better algorithm and stop writing spaghetti code, please...
-- Emmanuel The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html The C-library: http://www.dinkumware.com/refxc.html
"C is a sharp tool"
.
- References:
- main(int argc, char *argv[])
- From: Sokar
- main(int argc, char *argv[])
- Prev by Date: a few doubts!
- Next by Date: Re: a few doubts!
- Previous by thread: Re: main(int argc, char *argv[])
- Next by thread: Re: return a string
- Index(es):
Relevant Pages
|