I am learning how to write C in Visual Studio, and here is my code,
#include<stdio.h>
int main() {
char me[20];
printf("What is your name?");
scanf_s("%s", me);
printf("darn glad to meet you, %s!\n", me);
return(0);
}
Now, after typing all that in I get an error popping up "Unhandled exception at 0xFEFEFEFE in Project14.exe: 0xC00001A5: An invalid exception handler routine has been detected (parameters: 0x00000003)"
You're using
scanf_s()
wrong. The way described in MSDN isscanf_s("%s", me, sizeof me);
Also you really should check the return value of the function
Also note that the MSDN description and the C11 Standard description only have minor differences except that MSDN fails to inform you the function is optional for Standard compliant implementations. If you intend to run your code in other than Windows, you may want to add checks for the existence of the function or use some other way to get user input.