Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void reverse(char * c)
- {
- int i = 0;
- int j = 0;
- while (*(c+j)!=NULL)
- {
- j++;
- }
- char temp;
- for (i = 0, j = j - 1; i < j; i++,j--)
- {
- temp = *(c+i);
- *(c+i) = *(c+j);
- *(c+j) = temp;
- }
- }
- int main(int argc, char *argv[])
- {
- char * s = "abcdef";
- printf("%s\n", s);
- reverse(s);
- printf("%s\n", s);
- return 0;
- }
Add Comment
Please, Sign In to add comment