This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

printf does not work CCS4

when I write code:

void main(void) {


FILE * fp;
int number;
char temp[100];
//int pdata1[7201]; does not work but 5000 works, is there a upper limit for array size???
int * pdata1 = malloc(sizeof(int)*50000);
int counter1 = 0;

char filename[] = "file1.txt";
fp = fopen(filename,"r");
if ( fp == NULL)
{
printf("Error opening file %s\n",filename);
return ;
}
else
printf("Success opening file %s\n",filename);


while (fgets(temp,10,fp) != NULL)
{
counter1++;
pdata1[counter1] = atoi(temp);

}
printf("%d ",pdata1[2]);
fclose(fp);

return;
}

It does not print out the pdata1[2] line, Only opening file line is print out.  Why does this happen?

Jingrui