D
dkumar142
It is a simple example. But it gives run time error regarding memory.
Do you see any error? Is it related to dynamic memory allocation?
Any help would be appreciated.
Thank you.
#include "stdio.h"
int main()
{
FILE *outFile;
char *array;
array[0]='s';
array[1]='\0';
outFile = fopen("output.txt", "w");
printf("%c \n",array[0]);
fprintf(outFile, array);
return 0;
}
Do you see any error? Is it related to dynamic memory allocation?
Any help would be appreciated.
Thank you.
#include "stdio.h"
int main()
{
FILE *outFile;
char *array;
array[0]='s';
array[1]='\0';
outFile = fopen("output.txt", "w");
printf("%c \n",array[0]);
fprintf(outFile, array);
return 0;
}