+ 2

What is wrong in following code ? error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

void store(string line){ this->line=line; cout<<typeid(line[0]).name(); if(line[0]=="<" && line[1)=="/"){ // line[1) changed to line[1] still error occurs } else{ this->getTag(); this->attribute(); this->attributeVal(); cout<<tag<<endl<<attribute_name<<endl<<attributeValue; t1=make_tuple(tag,attribute_name,attributeValue); } } //error: ISO C++ forbids comparison between pointer and integer [-fpermissive] // function is member function

25th Apr 2021, 3:30 AM
𝖆𝖙.𝖚𝕷
𝖆𝖙.𝖚𝕷 - avatar
5 Answers
+ 1
line[0] == '<' use single quote for char..double quote means literal string(const char*)
25th Apr 2021, 4:37 AM
durian
durian - avatar
+ 4
line[1) Shouldnt it be a closing square bracket instead of closin parenthesis 🤔
25th Apr 2021, 3:47 AM
arturop200
arturop200 - avatar
+ 2
You are missing a right bracket in line 4. I don't see any other problems - at a quick glance.
25th Apr 2021, 3:51 AM
Jerry Hobby
Jerry Hobby - avatar
+ 1
Still it I got error: ISO C++ forbids comparison between pointer and integer
25th Apr 2021, 4:32 AM
𝖆𝖙.𝖚𝕷
𝖆𝖙.𝖚𝕷 - avatar
0
Thank for your support guys 👏👏
25th Apr 2021, 4:39 AM
𝖆𝖙.𝖚𝕷
𝖆𝖙.𝖚𝕷 - avatar