#include "stdio.h"
#include "stdlib.h"
#include "string.h"
void reverseStr(char *strPointer)
{
char temp;
char *p,*q;
p = strPointer;
q = &strPointer[strlen(strPointer)-1];
for(;p<=q;p++,q--)
{
temp =*p;
*p =*q;
*q=temp;
}
}
int main(void)
{
char s[] = "Hello, World!";
reverseStr(s);
printf("%s",s);
return 0;
}
=====Result=====
沒有留言:
張貼留言