I've written a simple code in C that takes in an ASCII decimal value and returns the char value that corresponds to the inputted decimal. For example, 65 would print out 'A'.
int x;
printf("Enter an ASCII number: ");
scanf_s("%d", &x);
printf("Entered letter is: %c\n", x);
However if I change line 1 from int x to char x, the program will run into run-time check failure #2 stating stack around variable x was corrupted when I test the program with x = 65. I understand this usually happens if I am out of bounds of assigned memory, but 65 should still be within the memory limit of char. Why is this happening?