Odd output from reversed string program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Odd output from reversed string program

as a little c++ practice I'm trying to reverse a string. problem is, it more jumbles the string than reverses it. am I reversing the string wrong? https://code.sololearn.com/c2QyAe3BzEO1/?ref=app

9th Sep 2017, 11:10 AM
X-1
X-1 - avatar
1 Answer
+ 1
text is of type char[] (equivalent to char*). sizeof(text) == sizeof(char*) == sizeof(void*) It does not give the length of the array
9th Sep 2017, 11:16 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar