I'm learning C with help of a book and one of the challenges is to create a number guessing program.
The compiler doesn't give me an error but when i run the program and enter a number
it exits with "Segmentation fault (core dumped)" error:
Can anyone help please?
int iRandom = 0;
char cResponse = '\0';
iRandom = (rand() % 10) +1;
printf("\nGuess a number between 1 and 10: ");
if (cResponse == iRandom)
printf("\nCongratulations, you guessed correct!");
printf("\nSorry, you guessed wrong.");
printf("The correct number was: %d", iRandom);
printf("You did not enter a number");