c语言数组的逆序
2014-08-16 14:42
274 查看
include <stdio.h> #include <stdlib.h> #define M 10 #include <time.h> int main(int argc, const char * argv[]) { int i; int j; int t=0; int tmp; int n; int a[M]={}; srand(time(NULL)); for (i=0; i<M; i++) { a[i]=rand()%100; printf("%d ",a[i]); } printf("\n"); //逆序 for (i=0; i<M/2; i++) { tmp=a[i]; a[i]=a[M-i-1]; a[M-i-1]=tmp; } printf("\n"); //输出 for (i=0; i<M; i++) { printf("%d ",a[i]); } return 0; }
相关文章推荐
- C语言实验题——数组逆序
- 【源码】将一个整数的每位数分解并按逆序放入一个数组中(用递归算法)(C语言实现)
- C语言中数组逆序的实现
- 常见C语言面试题之六:数组逆序
- C语言实验-数组逆序
- C语言实验——数组逆序 (sdut oj)
- FFT之数组逆序C语言实现
- C语言学习,将一个数组中的值按逆序重新存放,例如原来顺序为8,6,5,4,1 。要求改为1, 45,8
- neuq oj 1060: 谭浩强C语言(第三版)习题7.5 数组逆序 C++
- C语言——实例040 数组逆序输出
- 第十四周-C语言 oj上机题目(数组逆序)
- 1186 理工大学ACM平台题答案关于C语言 C语言实验——数组逆序
- 【源代码】将一个整数的每位数分解并按逆序放入一个数组中(用递归算法)(C语言实现)
- 【C语言】.如何求一个整形数组逆序。
- 认识一维数组、字符数组与字符串(c语言)———(逆序数组、字符串简单拷贝)
- C语言实验——数组逆序
- 将一个数组中的值按逆序重新存放(简易版)C语言实现
- C语言 逆序一个数组的代码实现
- 【C语言】求一个整形数组逆序
- C语言 写一个函数,将一维数组中的元素逆序存放