Wednesday, May 15, 2019

c++ - lvalue required as increment operand error when using #define




Whats the problem with the code below, and why I'm getting this error?



#include 
#define A 1
using namespace std;

int main()
{
cout < return 0;

}

Answer



#define A 1


A is not valid c++ left value, so gave us "lvalue required as increment operand"



int A; 



is valid c++ left value and will work, also of other simple number type float, unsigned char etc


No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...