Segmentation Fault (SIGSEGV). Link to code The code gives Segmentation fault error due to the input taken to store the values for vector of struct.
#include<
Here is the code that works. I specify the size of the vector when I construct it.
vector v(n);
Compile code:
#include using namespace std; struct s{ int a; int d; }; int main(){ int n; cin>>n; vector v(n); for(int i=0;i>v[i].a; } for(int i=0;i>v[i].d; } return 0; }