C 练习实例90

C语言教程评论

C 练习实例90

题目:专升本一题,读结果。

程序分析:无。文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili90.html

实例

#include<stdio.h>
#include<stdlib.h>

#define M 5
int main()
{
    int a[M]={1,2,3,4,5};
    int i,j,t;
    i=0;j=M-1;
    while(i<j)
    {
        t=*(a+i);
        *(a+i)=*(a+j);
        *(a+j)=t;
        i++;j--;
    }
    for(i=0;i<M;i++) {
        printf("%d\n",*(a+i));
    }

}

以上实例运行输出结果为:文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili90.html

5
4
3
2
1
文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili90.html文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili90.html
运营不易,
感谢支持!
weinxin
我的微信
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
 最后更新:2021-12-7
公式库网
  • 本文由 公式库网 发表于 2021年12月6日21:23:36
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202112/c-lianxishili90.html

发表评论