10.13-3 指针与一维数组相关运算
来源:互联网 发布:高要网络问政平台 编辑:程序博客网 时间:2024/06/07 10:14
【输出数组最大值】
#include<stdio.h>#define SIZE 5void max( int *source,int *end);int main(){ int source[SIZE] = { 1,2,3,4,5 }; printf("the max of the arry:\n"); max(source, source + SIZE); getchar(); getchar(); return 0;}void max( int *source, int *end){ int max = *source; while (source < end) { if (max < *source) { max = *source; source++; } else { source++; } } printf("%d ", max);}
【数组逆序输出】
#include<stdio.h>#define SIZE 5void Reverse_Arry( double *source, double *arry, double *end);int main(){ double source[SIZE] = { 1.1,2.2,3.3,4.4,5.5 }; double arry[SIZE] = { 0 }; Reverse_Arry(source, arry, source + SIZE); for (int i = 0; i < SIZE; i++) printf("%8.3lf ", arry[i]); putchar('\n'); getchar(); getchar(); return 0;}void Reverse_Arry(double *source, double *arry, double *end){ while (source < end) { *(arry + (SIZE-1)) = *(source); source++; arry--; }}
阅读全文
0 0
- 10.13-3 指针与一维数组相关运算
- 指针的相关运算,包括一维数组、二维数组、字符数组的sizeof、strlen运算
- cppTest-3.0:指针相关-1(指针与一维数组)
- 指针和数组相关运算
- 指针与数组运算
- 一维数组与指针
- 一维数组与指针
- 一维数组与指针
- 【论指针(3)】指针与一维数组
- cppTest-3.0:指针相关-2(二维数组&一级指针&二级指针&一维指针数组)
- 二维数组与指针运算
- 指针与数组(一)
- 指针与数组 (一)
- C++一维数组与指针
- C++指针与一维数组
- C-034.指针与一维数组
- 指针与一维、二维数组
- 16、指针与一维数组
- 10.3 指针
- 10.7 指针 :指针和多维数组
- 10.13-2 数组拷贝
- $ref':'$[0].coupon.merchants[0]' ,数据引用问题
- 调用pcl计算法向量,并将法向量可视化
- 10.13-3 指针与一维数组相关运算
- (1)JVM运行时数据分区
- 10.13-7 指针与二维数组copy
- 11.1 字符串和指针
- jquery 点击元素实现背景色改变,点击元素以外任意地方还原该元素背景色
- 11.2 字符串和字符串函数:fgets()函数
- 11.3 字符串输出 puts()
- CentOS 安装zlib
- 11.3 字符串和字符数组:缩短数组长度