2020年6月16日

使用指针交换字符

摘要: #include"stdio.h"#define N 100#include"string.h"int fun(char a[N]){ int k,i=0; char *q=a,*p,t; k=strlen(a); p=a+k-1; while(i<k/2) { t=*q; *q=*p; *p=t; 阅读全文

posted @ 2020-06-16 08:53 白胡 阅读(508) 评论(0) 推荐(0) 编辑

使用指针交换数字

摘要: #include <stdio.h> #define N 100 #include"string.h"void main(){ int a[9]={1,2,3,4,5,6,7,8,9}; int *p=a,t,i; int *q=a+9-1; while(q>p) { t=*p; *p=*q; *q 阅读全文

posted @ 2020-06-16 08:41 白胡 阅读(283) 评论(0) 推荐(0) 编辑

导航