What I am trying to do is to access a string value in a multidimensional string array in C. The string is actually a number value which I want to store in an integer value.
When I try to print the value as following
printf("TESTING COMMAND\n");
printf("%d\n",commands[0][0]);
The value prints the normal expected value
However when I try to use it to initialize an array for example as below
char **options[ (x - 1) ];
This gives the following error
error: size of array ‘options’ has non-integer type
Which I expect because the command array is declared as following
char ***commands;
The thing is that even if I try to assign an integer variable to hold this value I get a segmentation error
x = command[0][0];
I have also tried functions like strtol
which led to the same result. However I am not sure if I have used the function right.
Any suggestions ?
int x;
printf("TESTING COMMAND\n");
printf("%d\n",commands[0][0]);
x = command[0][0];
printf("Creating options of size = %d\n", x );