I keep getting an error and I can't figure out why:
"Unhandled exception at 0x004115f4 in polynomials.exe: 0xC0000005: Access violation writing location 0x00339000."
When I step through that section of code, everything works fine.
Am I missing something or could there be something further on that corrupts my program?
Any help is appreciated!
Code:char *a, *polynomial[MAX], ch;
for(k = 0; k < number; k++) {
for(p = 0; ; p++) {
ch = fgetc(text);
*(a+p) = ch; //error here
if(ch == '\n') {
break;
}
}
if(k < number - 1) {
polynomial[k] = a;
a = calloc(1,MAXPOLY*sizeof(char));
if(a == NULL) {
printf("Error involved in allocating space. Cannot complete task.");
exit(EXIT_FAILURE);
}
}
}