I have this function and it adds a number to itself.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#define ADD(x) (x)+(x)
int main()
{
int x = 2;
int y = ADD(++x);
cout << y << endl;
}
When I run this program, it returns 8 but I was expect 6.
I thought x = 3 and it was sending 3 to the ADD function but it seems like it doesn't. Can someone explain it to me?