I have problem with this code:
#include
using namespace std;
int main()
{
int t, *n, a, b;
cin>>t;
while ( t-- ){
cin>>*n;
a=0;
while ( *n!=0 ) {
b=*n%10;
a=a*10+b;
*n=*n/10;
};
cout<<a<<'\n';
}
return 0;
}
while it works on my computer, it doesn’t work here. When I substitude the pointers with int, the code works. Can someone clarify this for me?
Thanks