I'm trying to make a "tik-tak-toe" program and I tried to make it repeat, so I used a while loop. I ask the user type 1 for yes, and 2 for no. After that I had a scanf_s statement. For some reason visual studios 2015 is giving me a warning right when I type one for yes and press enter :
"Unhandled exception at 0x5D14B5F2 (ucrtbased.dll) in tick-tack-toe.exe: 0xC0000005: Access violation writing location 0x00000001." This warning does not show up when I pressed 2 to for no.
I used the debugger to find what was going wrong and I found that it was the scanf_s statement. I've tried to make it just a regular scanf statement but when I run the code is says that the code failed and that the error is,
"'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." I've went all over the internet and tried everything I found but nothing worked. :(
int repeat = 1;
while(repeat == 1){
printf("do you want to play again \n 1.yes \n 2.no \n");
scanf_s("%d", repeat);
}
I expect my code to go back to the start when I press 1 but instead it bugs up.