LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   array of char pointers (https://www.linuxquestions.org/questions/programming-9/array-of-char-pointers-275444/)

djgerbavore 01-08-2005 01:48 PM

array of char pointers
 
i'm writing a program, and i'm having trouble with the pointers. My pointers are array of strings. i'm trying to traverse the whole array of strings. This is my first langauge with pointers, so i'm alitle confused....

in pseudo code:
Code:

while(args != NULL) {
        print current string ( current string pointer points too )
        move to next string
        loop
}

Thanks

djgerbavore

leonscape 01-08-2005 01:55 PM

I'm not quite sure what your asking here?
What language are we talking about?
Is the last member of the array a NULL pointer? Otherwise your going to have problems.

george_mercury 01-08-2005 01:59 PM

In case you're trying to read from command line you could do this:

int a;
for (a = 0; a < argc; a++) {
printf("Argument: %s\n" , argv[a]);
}

This will print all arguments; if this is what you're trying to do.


All times are GMT -5. The time now is 09:34 PM.