Re: Is it perfectly to pass argv[] this way to function ?
On Tuesday 21 May 2002 04:31 am, Deepak Kotian wrote:
> 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
It might work, but I'd say it's probably more standard and more portable to
use standard
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: