Re: Is it perfectly to pass argv[] this way to function ?

2002-05-21 Thread Deepak Kotian
Thanks for all the replies!! > > Hi, > > > > Please check the code segment. > > /*code start / > > #include > > int func1(char **a_argv){ > > while (*a_argv!=NULL) > > printf("\n%s", *a_argv++); > > return(0); > > } > > > > int main(int argc, char *argv[]){ > > func1(&argv[0])

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-21 Thread Michael van der Kolff
On Tuesday 21 May 2002 04:31 am, Deepak Kotian wrote: > Hi, > > Please check the code segment. > /*code start / > #include > int func1(char **a_argv){ > while (*a_argv!=NULL) > printf("\n%s", *a_argv++); > return(0); > } > > int main(int argc, char *argv[]){ > func1(&argv[0]);

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-21 Thread Michael van der Kolff
On Tuesday 21 May 2002 04:31 am, Deepak Kotian wrote: > Hi, > > Please check the code segment. > /*code start / > #include > int func1(char **a_argv){ > while (*a_argv!=NULL) > printf("\n%s", *a_argv++); > return(0); > } > > int main(int argc, char *argv[]){ > func1(&argv[0]);

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Elizabeth Barham
Craig Dickson <[EMAIL PROTECTED]> writes: > He didn't write "**argv != NULL", he wrote "*argv != NULL" -- in other > words, not "last argument is a null string", but "the last pointer in > the argv array is a NULL". Which is a common behavior (both gcc 2.95 and > Microsoft Visual C++ do it, at lea

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Craig Dickson
Elizabeth Barham wrote: > The only thing that is troubling is the (**argv != NULL) which assumes > that the last string is a NULL string (the first character is NULL), > as opposed to using the count (argc), which may not be the case (it's > not here). He didn't write "**argv != NULL", he wrote "

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Alan Shutko
Craig Dickson <[EMAIL PROTECTED]> writes: > I think the convention that argv[argc] == NULL is common enough that > this should be acceptable in practice, but I'm not sure it's actually in > the C89 standard, FWIW, it is. Section 5.1.2.2.1. -- Alan Shutko <[EMAIL PROTECTED]> - In a variety of f

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Elizabeth Barham
Hi Deepak, "Deepak Kotian" <[EMAIL PROTECTED]> writes: > Hi, > > Please check the code segment. > /*code start / > #include > int func1(char **a_argv){ > while (*a_argv!=3DNULL) > printf("\n%s", *a_argv++); > return(0); > } > > int main(int argc, char *argv[]){ > func1(&arg

Re: Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Craig Dickson
Deepak Kotian wrote: > Please check the code segment. > /*code start / > #include > int func1(char **a_argv){ > while (*a_argv!=NULL) > printf("\n%s", *a_argv++); > return(0); > } > > int main(int argc, char *argv[]){ > func1(&argv[0]); > } > /*code end / > >

Is it perfectly to pass argv[] this way to function ?

2002-05-20 Thread Deepak Kotian
Hi,   Please check the code segment. /*code start / #include int func1(char **a_argv){ while (*a_argv!=NULL) printf("\n%s", *a_argv++); return(0);}   int main(int argc, char *argv[]){ func1(&argv[0]);} /*code end /   This func1 function prints all the arguments