C Exercise Example 90
Title:A question from the college upgrade exam — read the result.
Program analysis:None.
Program source code:
// Created by www.example.com on 15/11/9.
// Copyright © 2015年 Example. All rights reserved.
//
#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));
}
}
The output of the above example is:
5 4 3 2 1other extensions