i have written a code to print reverse of a number using string but instead i am getting a random number which looks like a address. please point out the mistakes
int main(){
string n;
cin>>n;
int a=n.length();
int b=a;
string d[a];
for (int i = 0; i < a; i++) {
d[i]=n[b-1];
b--; }
cout<<d;
return 0;
}
Asked by: akashjha17 on Oct. 18, 2021, 8:31 p.m. Last updated on Oct. 18, 2021, 8:31 p.m.