I am confused why the two print statements give different output. Attaching the code snippet below. Any help would be appreciated. Thank You.
stack<int>st1;
stack<int>st2;
st2.push(222);
cout<<"st1 size:"<<st1.size()<<endl;
cout<<"st2 size:"<<st2.size()<<endl;
int a=st1.size();
int b=st2.size();
cout<<"difference:"<<a-b<<endl;
cout<<"difference:"<<(st1.size()-st2.size())<<endl; //why this is giving different ans
/* output:
st1 size:0
st2 size:1
difference:-1
difference:4294967295
*/