string array / subscript question

Hello, I am very new to C programming and this is my 2nd post.

I will try to phrase this the best I can...

Is it possible, if so how, to create a "string array"?

I would like to do something like the following with , say , string constants, or sort..

so as to define varibles with subscripts as ascii charactor strings.


float input[20];
int count;
char getting[100];

int main()
for (count = 1; count <= 10; ++count)
printf("Entry %d -->",count);
fgets(getting, sizeof(getting), stdin);
sscanf(getting, "%f", &input[count]);
printf("## %f ",input[count]);


count = 0;

for (count = 1; count <= 10; ++count)
printf("Exit %f -->



  • :
    : Is it possible, if so how, to create a "string array"?

    you mean you want to create an array of strings? The following is an array of 10 strings, each string can hold up to 79 characters plus one for the null terminator.
    char array[10][80];

    Here is an array of 10 character pointers. Each can contain a pointer to some string located in memory or it can be allocated with malloc().
    char *array[10];

    // 2 example:
    array[0] = "Hello World";

    array[1] = malloc(80);
    strcpy(array[1],"Hello World");


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion