vector - lvalue required as left operand of assignment error in c++ -
all of fellas, have problem code. try use macro , vector in code. but, there error in code, in macro code. dont know error. code : #include <iostream> #include <vector> #include <string> #include <algorithm> #include <ostream> using namespace std; #define loop(a,b) for((int)(a) = 0; (a) < (int)(b); (a)++) int main(){ vector<string> sentence; sentence.reserve(10); int i=0, c = sentence.size(); sentence.push_back("hello,"); sentence.push_back("how"); sentence.push_back("are"); sentence.push_back("you"); sentence.push_back("?"); loop(i,c){ cout << << endl; } return 0; } i hope of can me solve problem. regards. it bad idea use such kind of macros in c++. problem expression ( int )( ) is rvalue (some temporary object) , may not assign value like ( int )( ) = 0; either remove entirely casting or @ least use c...