上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: 首先把方法放在前面: 再来看有趣的实验: 8位二进制所能表示的范围是多少呢? 让我们来看下(计算机中都是补码表示,所以下面的数字也都是补码) 从0000_0000到1111_1111, 其中0000_0000全零代表数字是零, 0000_0001到0111_1111因为首位是零,所以代表的是正整数, 阅读全文
posted @ 2020-11-21 15:55 Connor_Jiao 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 什么是枚举? 把一个事物所有可能的取值一一列举出来。 枚举的优缺点? 代码更安全,但是书写麻烦 #include<stdio.h> enum WeekDay { MonDay,TuesDay,WednesDay,ThursDay,FriDay,SaturDay,SunDay }; void f(en 阅读全文
posted @ 2020-11-21 14:48 Connor_Jiao 阅读(93) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<malloc.h> #include<string.h> //动态构造学生管理系统 struct Student { int age; float score; char name[100]; }; int main(void) { int le 阅读全文
posted @ 2020-11-20 11:11 Connor_Jiao 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> //冒泡排序 void sort(int * a,int len) { int i,j,t; for(i=0;i<len-1;i++) { for(j=0;j<len-1-i;j++) { if(a[j]>a[j+1])//>表示升序,<降序 { t=a[j];/ 阅读全文
posted @ 2020-11-19 21:13 Connor_Jiao 阅读(131) 评论(0) 推荐(0) 编辑
摘要: /* //2020年11月19日17:24:42 #include<stdio.h> #include<string.h> void InputStudent(struct Student); struct Student { int age; char sex; char name[100]; } 阅读全文
posted @ 2020-11-19 21:12 Connor_Jiao 阅读(479) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>//2020年11月19日16:46:44//修改结构体变量成员的值-两种方式struct Student{ int age; float score; char sex;};int main(void){ struct Student st = {11,23.3, 阅读全文
posted @ 2020-11-19 16:49 Connor_Jiao 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 程序没有逻辑错误,因为子函数所占用的内存是动态分配的,存储在堆,而不是栈,静态内存之所以丢失是因为函数执行完毕要出栈,堆是手动分配的,函数执行完毕没有free就一直存在,所以p所指向空间不会丢失。 1 #include<stdio.h> 2 #include<malloc.h> 3 struct S 阅读全文
posted @ 2020-11-19 11:00 Connor_Jiao 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 虽然程序没有报错,但有逻辑错误,因为f函数运行完毕,内存就会释放,此时*p所指向的地址存放的是一个垃圾值。 阅读全文
posted @ 2020-11-19 10:42 Connor_Jiao 阅读(94) 评论(0) 推荐(0) 编辑
摘要: --------------------------------------------------------------------------------- 阅读全文
posted @ 2020-11-18 22:12 Connor_Jiao 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 1. malloch函数返回的是4个字节中的第一个字节的地址,那为什么要加强制类型转换呢,是因为根据第一个字节地址,可以把8个字节当一个变量也可以把4个字节当一个变量,所以malloc函数返回的是一个无意义的地址也就是干地址,所以需要告诉编译器我们返回的是哪种类型的地址,把第一个字节地址当成一个整形 阅读全文
posted @ 2020-11-18 21:49 Connor_Jiao 阅读(520) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 13 下一页