#include <stdio.h> #include <math.h>
void Sort(int *array,int iLen) { int i,j; for (i=0;i!=iLen-1;++i) { for (j=0;j!=iLen-1-i;++j) { if (abs(array[j])>abs(array[j+1])) array[j]^=array[j+1]^=array[j]^=array[j+1]; } } }
int main() { int i=0; int array[10]={0}; puts("enter 10 numbers:"); for (;i!=10;++i) scanf("%d",array+i); Sort(array,i); puts("after sort:"); for (i=0;i!=10;++i) printf("%d ",array[i]); puts(""); return 0; }
答案:(1)char*p[],intn
(2)*temp
(3)p[j],p[j+1])>0
(4)p[j]=p[j+1]
分析:(1)由实参得知函数sort()有两个形参,根据上题得char*p[],intn。
(2)有下面语句temp=p[j]可以得到temp是字符中指针。
(3)根据冒泡排序方法和字符串比较函数得到p[j],p[j+1])>0。
(4)字符串指针可以通过赋值语句传递值,字符串变量不能够使用赋值语句传递值。
TabbyCloud迎来一周岁的生日啦!在这一年里,感谢您包容我们的不足和缺点,在您的理解与建议下我们也在不断改变与成长。为庆祝TabbyCloud运营一周年和七夕节,TabbyCloud推出以下活动。TabbyCloud周年庆&七夕节活动官方网站:https://tabbycloud.com/香港CN2: https://tabbycloud.com/cart.php?gid=16购买链...
hostkey应该不用说大家都是比较熟悉的荷兰服务器品牌商家,主打荷兰、俄罗斯机房的独立服务器,包括常规服务器、AMD和Intel I9高频服务器、GPU服务器、高防服务器;当然,美国服务器也有,在纽约机房!官方网站:https://hostkey.com/gpu-dedicated-servers/比特币、信用卡、PayPal、支付宝、webmoney都可以付款!CPU类型AMD Ryzen9 ...
优惠码年付一次性5折优惠码:TYO-Lite-Open-Beta-1y-50OFF永久8折优惠码:TYO-Lite-Open-Beta-Recur-20OFF日本vpsCPU内存SSD流量带宽价格购买1核1.5G20 GB4 TB1Gbps$10.9/月购买2核2 G40 GB6 TB1Gbps$16.9/月购买2核4 G60 GB8 TB1Gbps$21.9/月购买4核4 G80 GB12 TB...