OSDN Git Service

Initial release for VER0.1.5
[lib1stclass/main.git] / reverse_char.c
1 /*
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright: 2010- 1stclass.co.jp.  All rights reserved.
5 *
6 * Created by Hajime Kurita
7 */
8 #include <string.h>
9 #ifdef __cplusplus
10 #include "1stclass.hpp"
11 int firstclass::reverse_char(char s[]){
12
13 #else
14 #include "1stclass.h"
15 int reverse_char(char s[]){
16
17 #endif
18
19   int c, i, j;
20   
21   for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
22     c = s[i];
23     s[i] = s[j];
24     s[j] = c;
25   }
26   return 0;
27 }