There is a Segmentation Fault on line cin >> num; for integer type.
#include <iostream>
using namespace std;
int main(void)
{
int num;
printf("Hello World\n");
cin >> num; // seg fault line
system("pause");
return 0;
}
While the char type runs fine.
#include <iostream>
using namespace std;
int main(void)
{
char str;
printf("Hello World\n");
cin >> str;
system("pause");
return 0;
}
I'm using VSCode and MinGW, the c_cpp_properties.json is as follow:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
"cStandard": "gnu11",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x86"
}
],
"version": 4
}