Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-08-2005, 01:48 PM   #1
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 446

Rep: Reputation: 30
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:
while(args != NULL) {
        print current string ( current string pointer points too )
         move to next string 

Old 01-08-2005, 01:55 PM   #2
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
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.
Old 01-08-2005, 01:59 PM   #3
LQ Newbie
Registered: Jun 2004
Location: Slovenia
Distribution: Gentoo
Posts: 27

Rep: Reputation: 15
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
c array of pointers greg108 Programming 10 08-17-2005 10:25 AM
SIGSEGV: Array of character pointers?? usercsr Programming 2 04-23-2005 11:34 AM
C pointers confusion - char ** = char [][] ?? saravkrish Programming 12 12-02-2004 10:06 AM
a question about array pointers in C veritas Programming 12 07-18-2004 06:31 PM
Help with getgrnam_r and char ** pointers paradoxicalogic Programming 1 08-20-2003 12:03 AM

All times are GMT -5. The time now is 10:51 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration