I used malloc() to make an array of floating point numbers like so:
float*x1;
x1 = (float*)malloc((vertexes/3)*sizeof(float));
if(x1 == NULL)
{
printf("Out Of Memory");
getchar(); return(1);
}
So far, it seems like the above is fine based on my limited knowledge, however when I attempt to use that array like this:
fscanf(stl,"%f",x1[N]); it does not work.
The N in brackets after the x1 is a variable that normally gets incremented, but for testing purposes I quoted out all that and just used any number that was within the range of the array like 3 for example. When I try to do this, the program compiles and runs fine until it hits the fscanf line of code. at that point it crashes and windows says its trying to find a solution to the problem. I tried using my dynamic array by putting x1[3] = 12345 which seemed to work, because printf("%f",x1[3]); outputted 12345 like it was supposed to. This leads me to believe the problem lies within fscanf(stl,"%f",x1[N]); but I have no clue why.
Thanks in advance for any advice, it is greatly appreaciated.