gcc 4.4.3 c89
I have the following source code. And getting a stack dump on printf.
char **devices;
devices = malloc(10 * sizeof(char*));
strcpy(devices[0], "smxxxx1");
printf("[ %s ]\n", devices[0]);
I think this should create a char array similar to this.
devices[0]
devices[1]
devices[2]
devices[4]
etc
And each item I can store my lines.
Thanks so much for any suggestions,
== Added correction ===
for(i = 0; i < 10; i++)
{
devices[i] = malloc(strlen("smxxxx1")+1);
}
source
share