19.04.13--小作业 指针应用

1./*编译器:VC6.0*/

#include<stdio.h>

//主函数

int main()

{

int a[]={5,100,32,45,21,67,32,68,41,99,13,71},i=0,j=0,x=0,len=0;

while(!(a+i++))len++;

i=0;

while(!(a+i))//冒泡排序

{

for(j=0;j<len-i;j++)

{

if(*(a+j)<*(a+j+1))

{

x=*(a+j);

*(a+j)=*(a+j+1);

*(a+j+1)=x;

}

}

i++;

}//冒泡排序结束

printf("第二大的数是%d\n",*(a+1));

return 0;

}

2./*编译器:VC6.0*/

#include<stdio.h>

//主函数

imt main()

{

int i=0;

char src[100]="hello",dst[100];

while(!(dst+i))*(dst+i)=*(src+i++);

return 0;

}

猜你喜欢

转载自www.cnblogs.com/redyellowblue/p/10700600.html