I am new to c++ and trying to compile the simple c++ programm. using vector
#include <iostream>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define BUFSIZE 100
using namespace std;
typedef struct AA{
int a;
std::string a_str;
}A;
typedef struct BB{
int b;
std::string b_str;
vector<AA> Aobj;
}B;
int main()
{
B bobj;
bobj.Aobj[0].a=4;
bobj.Aobj[0].a_str="DICOM";
bobj.b_str="LDAP";
bobj.b_str="DICOM";
size_t ipos;
ipos=bobj.Aobj[0].a_str.find("COM");
if(ipos!=string::npos)
cout<<"String Found Successfully....";
else
cout<<"String Not Found ....";
return 0;
}
when i compile the program it shows a error message Segmentation fault (core dumped) using Ubuntu OS