Most of your array is just unitialized garbage. When you reverse the entire array, that's what you see. Your loop should only cover the string that was entered, not the entire buffer.