Hey guys,
I've done some google searches today but didn't find a clear cut answer to this. I've got a function that I would like to return an array of strings. Any ideas anyone?
jkuboschek
0
Newbie Poster
Recommended Answers
Jump to PostYou could use char** as the return type, and pass in an integer pointer that will hold the total number of strings that you return to the calling function.
for example:
char** foo (int* nStrings, ....)
Jump to Postyes a char** is a pointer to a pointer.
Basically a char* can be used to define a array of characters or a string. And a char** is used to define an array of strings.
You could write something like this to allocate and populate a char**
All 6 Replies
stilllearning
148
Posting Whiz
jkuboschek
0
Newbie Poster
stilllearning
148
Posting Whiz
jkuboschek
0
Newbie Poster
stilllearning
148
Posting Whiz
jkuboschek
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.