C언어 문자열 뒤집기

1 개요[ | ]

C언어 문자열 뒤집기
#include <stdio.h>
#include <string.h>
int main() {
    char s[6] = "hello";
    int i, len, temp;
    len = strlen(s);
    for (i=0; i<len/2; i++) {
        temp = s[i];
        s[i] = s[len-i-1];
        s[len-i-1] = temp;
    }
    printf("%s\n", s); // olleh
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}