Skip to content

Commit 286afcd

Browse files
author
coppermilk
authored
Create ch11ex09.c
1 parent fab65df commit 286afcd

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

ch11/ch11ex09.c

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdio.h>
2+
3+
#include <string.h>
4+
5+
char string_reverce(char * string);
6+
int main() {
7+
char string[64] = "This is Sparta";
8+
string_reverce(string);
9+
printf("%s", string);
10+
11+
return 0;
12+
}
13+
14+
char string_reverce(char * string) {
15+
int len = strlen(string);
16+
int start, end, tmp;
17+
for (start = 0, end = len - 1; start < end; start++, end--) {
18+
tmp = string[start];
19+
string[start] = string[end];
20+
string[end] = tmp;
21+
}
22+
23+
}

0 commit comments

Comments
 (0)