0

This is my code towards the end of main():

printf("Would you like to find data on another 20 rods? \nType C and press enter to continue, or type E and press enter to exit \n");

scanf("%s",&exitOption);

if (exitOption == 'C'){
main();

}

return 0;   

Every time I run the program I get this error:

enter image description here

Why? How can I fix it?

turnt
  • 3,235
  • 5
  • 23
  • 39

1 Answers1

3

exitOption must be a character

scanf("%c",&exitOption);

Even if you are trying to get a string, it must be this way

char string[10];
printf("Enter string\n");
scanf("%s",string);  // note the second parameter of scanf() when u get a string
sr01853
  • 6,043
  • 1
  • 19
  • 39