Can somebody point me what is wrong with the following piece of code ?:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
using namespace std;
int main()
{
char ch[] = "hello77o";
char ch2[sizeof(ch)];
for(unsigned int i = 0; i < sizeof(ch)-1 ;i++){
while(ch[i]) ch2[sizeof(ch) - i -2 ] = ch[i];
}
cout<<ch2;
return 0;
}
|
Last edited on
Take another look at line 10 after the = . . . . what is ch2[i] at this point?
Last edited on
vs 2010 is giving a output with girbish ?