Last word is Failing …?

Try this: #include <stdio.h> #include <stdlib.h> #include <string.h> FILE *fr; int main (int argc, const char * argv[]){ char line[1024]; double uppercase = 0, lowercase = 0; int x = 0; fr = fopen (“PercenUpLow.txt”, “rt”); if (fr == NULL) { printf (“Can’t open file”) ; return EXIT_FAILURE ; } while(fgets(line, 1024, fr) != NULL) … Read more

Making an array using pointers in c

I think you want to create an array and read data to it and later display it using pointers dynamically. #include <stdio.h> #include <stdlib.h> int main() { int *A, n; printf(“\n Enter the size of array : “); // Reading the size of array scanf(“%d”,&n); A = (int*) malloc(sizeof(int) * n); // Allocating memory for … Read more

Segmentation fault, I don’t know why

I would recommend you to replace if(c!=’ ‘ && c!=’\t’ && c!=’\n’) with if(!isspace(c)) // Iam easier and more readable from ctype.h. Which detects all these characters ‘ ‘ space ‘\t’ horizontal tab ‘\n’ newline ‘\v’ vertical tab ‘\f’ feed ‘\r’ carriage return Also you should change char*** word_array; (three star general) to pointer to … Read more

C/SDL – Segmentation fault when program run multiple times in succession [closed]

Let me break down a debugging session for you, but in future you better do that yourself. If the problem can be easily reproduced, it is quite trivial to fix it: gdb ./GAME (gdb) r Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7b2d10c in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 (gdb) bt #0 0x00007ffff7b2d10c in ?? () from … Read more