[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



Thanks for all the replies!!

> > Hi,
> >
> > Please check the code segment.
> > /*************code start ****/
> > #include <stdio.h>
> > 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 with no problem, because
> > main() is probably always on stack, so it works probably.
> > Do anyone see any problem, if one passes argv[] this way ? Will there be
> > portability issues, like on other UNIX flavors,etc.
> >
> > Please let me know.
> >
> > Thanks and Regards
> > Deepak
>



-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: