[Solved] i’m getting segmentation fault(core dumped) when i execute this code… [closed]


if your file is greater than 100.000 you will write over :

a = (char *)malloc(sizeof(char)* 100000);   <--
    for (i = 0; (c = fgetc(fp)) != EOF; i++){
        a[i] = c;
    }

you should use file size perhaps

solved i’m getting segmentation fault(core dumped) when i execute this code… [closed]