摘要: #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) 编辑