c언어 문자열 거꾸로 출력질문
종달
2023.04.01
질문 제목 : c언어 문자열 거꾸로 출력질문합니다출력값에 original the string
hello world
어떻게 하는지 모르겠어요 ㅠㅠ질문 내용 :
#includestdio.h
#includestring.h
voidmain()
{
inti,len;
charstring_array[300];
printf(enterthestring\n);
gets(string_array);
len=strlen(string_array);
for(i=0;ilen/2;i++)
{
chartemp=string_array[i];
string_array[i]=string_array[len-1-i];
string_array[len-1-i]=string_array[i];
}
printf(swappingthestring\n);
puts(string_array);
}
여기서요
출력값
enter the string
hello world
original the string
hello world
swapping the string
dlrow olleh
이렇게 출력값을 나오게 해야되는데
original the string 이야 프린트 에프로 하면될거같구
헬로우 월드를 못출력시키겠어요 ㅜ