날마다 새롭게 또 날마다 새롭게

reverse - 문자열 뒤집는 함수 구현 코드 본문

프로그래밍/C / C++

reverse - 문자열 뒤집는 함수 구현 코드

아무유 2013. 3. 13. 16:34

#include <string.h>


/* reverse : reverse string s in place */

void reverse(char s[])

{

int c,i,j;

for(i=0,j=strlen(s)-1;i<j;i++,j--)

{

c=s[i];

s[i]=s[j];

s[j]=c;

}

}

Comments