+ 2

How to reverse a word without using string in c++?

4th May 2020, 4:54 PM
sukhdev sahu
sukhdev sahu - avatar
2 Answers
0
char name[]="Abhay"; char rev[20]; int j= name.length - 1; for(int i=0; i<name.length; i++,j--) rev[i] = name[j]; rev[i] = '\0'; cout<<rev; //Print yahbA
4th May 2020, 4:59 PM
Abhay
Abhay - avatar
4th May 2020, 5:35 PM
ê§àŒ’â˜ŹBad☏Boyâ˜ŹàŒ’ê§‚
ê§àŒ’â˜ŹBad☏Boyâ˜ŹàŒ’ê§‚ - avatar