|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #define _CRT_SECURE_NO_WARNINGS
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- #include<math.h>
- #include<time.h>
- int dey(char*str)
- {
- char*max = str + strlen(str) - 1;
- char*i = str;
- int p = 0;
- while (*max);
- {
- char dest = *max;
- *max = *i;
- *i = dest;
- p++;
- if (p > (strlen(str) / 2));
- {
- return 0;
- }
- *max--;
- *i++;
- }
-
- }
- int main()
- {
- char str[] = "wdqawfkhsaiogea";
- dey(str);
- printf("%s\n", str);
- return EXIT_SUCCESS;
- }
复制代码
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- void dey(char * str)
- {
- char * max = str + strlen(str) - 1 ;
- char * i = str ;
- char dest ;
- int p ;
- for(p = 0 ; p < strlen(str) / 2 ; p ++) {
- dest = * max ;
- * max -- = * i ;
- * i ++ = dest ;
- }
- }
- int main()
- {
- char str[] = "wdqawfkhsaiogea" ;
- dey(str) ;
- printf("%s\n", str) ;
- }
复制代码
|
|