(e-mail address removed) said:
I am writing a function that needs to return an array of strings and I
am having some trouble getting it right. I need some help.
Here is what I consider an array of 100 strings:
char *array_string[100]
You have three problems here:
1) you have been poorly-served by the answers you've received so far,
one of which gave you misinformation and the second of which ignored
your question completely in what seems a rather strange attempt to
"push" a non-standard function onto you (what ya playin' at, Chuck?);
2) what you consider an array of 100 strings is not in fact an array of
100 strings, but an array of 100 pointers to char - it can, however, be
used for storing 100 pointers to chars that are the first characters of
strings, so it's not a bad starting place, but you have to consider
memory issues (see below);
3) in C, there is no syntax for returning an array from a function.
You could instead:
a) create the memory for the array within the function itself, and
return a pointer to the address of that array's first element;
b) pass the memory for the array into the function via a parameter;
c) bypass the modularity principle completely.
c) is never good if there's some other way, so your best choice is
between a) and b).
You also need to make it clear where the strings come from, and whether
you just want to point to them or make actual copies of them. It makes
a difference when setting up an example.