#include<stdio.h>
#include<string.h>
void reverseArray(char *pArray)
{
int len = 0;
while(*pArray++)
{
len++;
}
if(len == 0)
{
return ;
}
char * temp = new char[len +1];
for(int i=0;i <len; i++)
{
temp[i] = pArray[len - i -1];
}
temp[len] = 0;
strcpy(pArray,temp);
printf("%s",pArray);
delete [] temp;
}
void swapValue(int *m, int *n)
{
//两数相加 会出现溢出
//*m += *n;
//*n = *m - *n;
//*m = *m - *n;
//不会溢出
*m ^= *n;
*n ^= *m;
*m ^= *n;
}
void main()
{
char test[20] = "asd wfg";
reverseArray(test);
int a = 20;
int b = 10;
swapValue(&a, &b);
}