salv0id
New Coder
Hello, first of all sorry if this is the wrong section, and second (smiley face) I'm having (probably) an issue with windows 10 and command prompt or windows powershell. I tried the code with ubuntu and the terminal actually works just fine and if the code has a problem the terminal will tell me (error like buffer overflow), but on windows the command prompt won't display the error.
The code is this
I know it will compile and run, but once I type more characters than what the array can hold Ubuntu will tell me about segmentation fault, but on windows it doesn't, why is that?
The code is this
Code:
#include<stdio.h>
int main()
{
char name[9];
scanf("%s", name); //I didn't included the "length" because I want to see if the segmentation fault appears on win10
printf("%s\n", name);
return 0;
}
I know it will compile and run, but once I type more characters than what the array can hold Ubuntu will tell me about segmentation fault, but on windows it doesn't, why is that?