上一页 1 ··· 342 343 344 345 346 347 348 349 350 ··· 407 下一页
摘要: c语言中数组元素的线性查找。 1、再数组中查找特定的元素,并返回查找的索引。 #include <stdio.h> #define NUMBER 7 #define FAILED -1 int func1(const int x[], int y, int z) { int i = 0; while 阅读全文
posted @ 2021-03-31 10:48 小鲨鱼2018 阅读(592) 评论(0) 推荐(0)
摘要: 创建一个函数,对元素个数为n的int型数组进行倒序排列,并将结果保存到另一个数组中。 1、 #include <stdio.h> #define NUMBER 9 void func1(int x[], const int y[], int z) { int i; for (i = 0; i < z 阅读全文
posted @ 2021-03-30 22:39 小鲨鱼2018 阅读(294) 评论(0) 推荐(0)
摘要: 创建一个函数,对元素个数为n的int型数组进行倒序排列 1、 #include <stdio.h> #define NUMBER 9 void func1(int x[], int y) { int i; for (i = 0; i < y / 2; i++) { int tmp = x[i]; x 阅读全文
posted @ 2021-03-30 22:26 小鲨鱼2018 阅读(341) 评论(0) 推荐(0)
摘要: 1、创建一个函数,返回元素个数为n的int型数组中的最小值 #include <stdio.h> #define NUMBER 7 int func1(const int x[], int y) { int i, min = x[0]; for (i = 0; i < y; i++) { if (x 阅读全文
posted @ 2021-03-30 21:54 小鲨鱼2018 阅读(327) 评论(0) 推荐(0)
摘要: c语言中函数的传递和const类型的修饰符。 c语言中函数的传递:对接受到的数组元素进行的修改,元素值的变化也会反映到再次调用时传入的数组中。 const类型的修饰符:在给函数传递数组时,如果担心传递给函数的数组的元素会被修改,只要在声明形参的时候加上被称为const的类型修饰符就可以了。 如果只是 阅读全文
posted @ 2021-03-30 21:31 小鲨鱼2018 阅读(235) 评论(0) 推荐(0)
摘要: c语言, 函数中数组的传递,形参和实参。 1、 #include <stdio.h> #define NUMBER 5 int func1(int x[], int y) ##函数中传递数组的形参 { int i, max = x[0]; for (i = 0; i < y; i++) { if ( 阅读全文
posted @ 2021-03-30 20:29 小鲨鱼2018 阅读(1466) 评论(0) 推荐(0)
摘要: 1、 通过函数原型声明,可以指定函数的参数以及返回值的类型等信息,这样就可以放心地调用函数了。 库函数printf和puts等的函数原型声明就包含在<stdio.h>文件中,因此必须执行 #include <stdio.h> 固定指令,通过执行 #include <stdio.h>指令,就可以将库函 阅读全文
posted @ 2021-03-30 18:28 小鲨鱼2018 阅读(427) 评论(0) 推荐(0)
摘要: c语言中的文件作用域。 1、c语言中的文件作用域 #include <stdio.h> #define NUMBER 5 ## 对象式宏 int v[NUMBER]; ## 在函数外声明的变量,文件作用域,定义声明 int func1(void); ## 因为func1函数是在main函数之后创建的 阅读全文
posted @ 2021-03-29 22:30 小鲨鱼2018 阅读(729) 评论(0) 推荐(0)
摘要: c语言中编写函数求五个学生中的最高分。 1、 #include <stdio.h> #define NUMBER 5 int v[NUMBER]; int func1(void) { int i, max = v[0]; for (i = 0; i < NUMBER; i++) { if (v[i] 阅读全文
posted @ 2021-03-29 22:02 小鲨鱼2018 阅读(1221) 评论(0) 推荐(0)
摘要: 1、c语言中没有形参的函数 #include <stdio.h> int func1(void) ## 没有形参的函数 { int i; puts("please input an integer."); do { printf("i = "); scanf("%d", &i); if (i <= 阅读全文
posted @ 2021-03-29 21:16 小鲨鱼2018 阅读(901) 评论(0) 推荐(0)
上一页 1 ··· 342 343 344 345 346 347 348 349 350 ··· 407 下一页