Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fb7a575

Browse files
添加 0344.反转字符串.md C语言版本
1 parent 712ab9a commit fb7a575

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

problems/0344.反转字符串.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,19 @@ func reverseString(_ s: inout [Character]) {
218218
}
219219
```
220220

221-
221+
C:
222+
```c
223+
void reverseString(char* s, int sSize){
224+
int left = 0;
225+
int right = sSize - 1;
226+
227+
while(left < right) {
228+
char temp = s[left];
229+
s[left++] = s[right];
230+
s[right--] = temp;
231+
}
232+
}
233+
```
222234
223235
224236
-----------------------

0 commit comments

Comments
 (0)