So is this like a dynamically allocated multidimensional array that I can access elements in the array with a pointer? If I make two pointers, are those two pointers the positions in my multidimensional array? All these pointers are confusing to me. I can read about it a million times but when I try to implement them on an actual program, I get lost.
Code:
char **answerArray(FILE *ifp,int n){
char **strings = calloc(n, sizeof(char));
int i;
for(i=0; i<n; i++)
{
strings[i] = calloc(10, sizeof(char)); // Does this restrict my string to 10?
fscanf(ifp,"%s",strings[i]);
}
return strings;
}
So I would have to allocate mem for each position in my array? Im trying to do that here with the for loop. My max string length is ten.. When I call calloc to allocate memory for each column position in the array, if I want the max length of my string to be 10 characters, is this how I would write it?