Hi,
every where I see
Code:int main(int argc, char *argv[])
if i write
is this OK to write like this..Code:int main(int a, char **b)
or any problem is there... Please explain.
thanx
Hi,
every where I see
Code:int main(int argc, char *argv[])
if i write
is this OK to write like this..Code:int main(int a, char **b)
or any problem is there... Please explain.
thanx
Both are correct
The function called at program startup is named main. The implementation declares no
prototype for this function. It shall be defined with a return type of int and with no
parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent;**) or in some other implementation-defined manner.
**Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
char ** argv, and so on.
thanks for ur reply...
here what i want to know is
whether "argc" and "argv" are keywords...or I can use any names....
I got this doubt just now and I dont have C compiler to test it.
thanx
They arent keywords you can call them whatever you want.
But if you had read the post of Wledge carefully you shouldof know that.
quote from Wledge's quote
referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
Originally Posted by Salem
Don't, whatever you do, read this.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]