ReactOS 0.4.16-dev-927-g467dec4
strrev.c
Go to the documentation of this file.
1/***
2*strrev.c - reverse a string in place
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* defines _strrev() - reverse a string in place (not including
8* '\0' character)
9*
10*******************************************************************************/
11
12#include <string.h>
13
14/***
15*char *_strrev(string) - reverse a string in place
16*
17*Purpose:
18* Reverses the order of characters in the string. The terminating
19* null character remains in place.
20*
21*Entry:
22* char *string - string to reverse
23*
24*Exit:
25* returns string - now with reversed characters
26*
27*Exceptions:
28*
29*******************************************************************************/
30
32 char * string
33 )
34{
35 char *start = string;
36 char *left = string;
37 char ch;
38
39 while (*string++) /* find end of string */
40 ;
41 string -= 2;
42
43 while (left < string)
44 {
45 ch = *left;
46 *left++ = *string;
47 *string-- = ch;
48 }
49
50 return(start);
51}
#define __cdecl
Definition: accygwin.h:79
char *CDECL _strrev(char *s)
Definition: strrev.c:16
GLuint start
Definition: gl.h:1545
GLint left
Definition: glext.h:7726
char string[160]
Definition: util.h:11