This is what I coded on Mobile C
#include <iostream>
using namespace std;
int main()
{
int i{14},j{20};
int *pj{&j},*pi{&i};
cout<<endl<<(unsigned)pi;
cout<<"\t"<<*pi;
cout<<endl<<(unsigned)pj;
cout<<"\t"<<*pj;
--pi;
++pj;
cout<<endl<<(unsigned)pi;
cout<<"\t"<<*pi;
cout<<endl<<(unsigned)pj;
cout<<"\t"<<*pj;
return 0;
}
And this was the output:
2582956840 14
2582956836 20
2582956836 20
2582956840 14
But when I'm trying to do this on visual code (fedora 36) and the terminal compiler g++ is throwing errors, as mentioned above in the Imgur image.
EDIT2:
I did this:
#include <iostream>
using namespace std;
int main()
{
unsigned int i{14},j{20};
unsigned int *pj{&j},*pi{&i};
cout<<endl<<(unsigned*)pi;
cout<<"\t"<<*pi;
cout<<endl<<(unsigned*)pj;
cout<<"\t"<<*pj;
--pi;
++pj;
cout<<endl<<(unsigned*)pi;
cout<<"\t"<<*pi;
cout<<endl<<(unsigned*)pj;
cout<<"\t"<<*pj;
return 0;
}
And got this output:
0x7fff539232d0 14
0x7fff539232d4 20
0x7fff539232cc 21863
0x7fff539232d8 1402090200
Strange! It was compiled using onlinegdb C++ compiler.