Can we say this error as CORE DUMPED (SEGMENTATION FAULT)?

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
    int i=0;
    string s;
    vector<string>v;
    
    for(i=0;i<5;i++){
        cin>>s;
        if(s[i]=='T')
        v.push_back(s);
    }
    
    for(i=0;i<5;i++){
        cout<<v[i]<<endl;
    }
    
}

Input :
TY0
TT0
SYT
TTT
TTT

Output :
Runtime Error

can we say this error as CORE DUMPED (SEGMENTATION FAULT)?

obviously it shows RE , bcz let say your 3rd string is “ab” , now u have only two index 0 and 1 and u r comparing s[3] , which is not present.

1 Like

yes , if(a && b ) or if( a and b) works same

ok , thanks got this!!