Hey,
Having some issues with a pointer to an array.
Code:
GEOMOBJ **geometricObjects;
numOfObjects = readTextFile(fileName, geometricObjects);
I have this function:
Code:
int readTextFile(char *filename, GEOMOBJ **p){
*p = malloc(sizeof(GEOMOBJ) * numOfObjects);
for (i = 0; i < numOfObjects; i++){
*p[i] = i;
}
return numOfObjects;
}
I've determined that the segmentation fault is coming from the for loop. What I'm trying to accomplish is pass a pointer to an array to the function and have the function fill the array and return an integer.