2021年7月28日
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 5 6 int search(); 7 8 9 int main() 10 { 11 12 13 int index = search(); 14 printf("找到的元素的下标是:%d\n",index 阅读全文
posted @ 2021-07-28 10:45 Bytezero! 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 1 ////实现pow函数 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 double power(double,int) ; //函数原型 6 int main() 7 8 { 9 10 printf("%d的%d次幂等于: %.2lf\n",5,2 阅读全文
posted @ 2021-07-28 10:35 Bytezero! 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 1 //函数调用 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <math.h> 6 //根据传入的半径,返回圆的面积 7 double calcCircle(double); 8 9 //要对用户输入进行非负的判断 10 int v 阅读全文
posted @ 2021-07-28 10:35 Bytezero! 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 递归指的是在函数的定义中使用函数自身的方法。 举个例子:从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?"从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?'从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?……'" 例 阅读全文
posted @ 2021-07-28 10:15 Bytezero! 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 任何一种编程中,作用域是程序中定义的变量所存在的区域,超过该区域变量就不能被访问。C 语言中有三个地方可以声明变量: 在函数或块内部的局部变量 在所有函数外部的全局变量 在形式参数的函数参数定义中 局部变量 在某个函数或块的内部声明的变量称为局部变量。它们只能被该函数或该代码块内部的语句使用。局部变 阅读全文
posted @ 2021-07-28 10:05 Bytezero! 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int whileCount = 0; //全局变量,用来记while循环执行的轮数 5 //作用域只在当前的源文件 6 //extern int whileCount; //可以在其他源文件 引用 外部变 阅读全文
posted @ 2021-07-28 10:00 Bytezero! 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 //引用传递 传的地址 5 void change(int *); 6 7 void change(int *num) 8 { 9 *num +=1; 10 } 11 12 int main() 13 { 阅读全文
posted @ 2021-07-28 09:55 Bytezero! 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 1 //书写一个小型的学生成绩管理系统 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #define N 5 6 //书写一个小型的学生成绩管理系统 7 void input(double []); 8 void sort(double []); 9 阅读全文
posted @ 2021-07-28 09:50 Bytezero! 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 //字符串和字符数组的区别:最后一位是否是 \0,空字符 有的为 字符串 没有的 为字数组 6 //所有的字符串都是字符数组 对的 7 //所有的字符数组都是字符串 错的. 8 / 阅读全文
posted @ 2021-07-28 09:40 Bytezero! 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 //返回传入字符串的长度 6 int GetStrLength(char[]); 7 8 //封装fgets<用来接收字符串的字符数组,接收的字符总数 9 void G 阅读全文
posted @ 2021-07-28 09:32 Bytezero! 阅读(133) 评论(0) 推荐(0) 编辑