dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/05/86)
Sorry, argv[] CAN be addressed with a double array subscript. The first subscript accesses the particular char * pointer, the second accesses the particular character in that pointer. The following are equivalent: char **argv; char *argv[]; ------------------------------------------------------------------ argv[i] -returns char *, a pointer to argument i argv[i][0] -returns a char, the first character in argument i argv[i][n] - etc... As to the original problem: Did anyone think to check if the string returned by argv[i] ended in \0? If so, then the problem is with Lattice... generating bad code. Otherwise, the problem is with the startup module. I wasn't tracking the discussion, so I may be way off track here. -Matt Your message: >From: walton@ametek.UUCP (Steve Walton) >Ahem...argv is not a two dimensional array, but rather an array of pointers. >As such, it CANNOT be addressed with two subscripts as argv[n][n]. There >is a difference, see K&R for details. The correct way to find the \0 at >the end of the j'th argument is: > char *s; > s = argv[j]; > for (i = 0; s[i] != '\0'; i++); /* i is now length of arg j */ >If I badly misunderstood Bill's posting and have therefore insulted >everyone's intelligence, forgive me.