苏嵌//张朋//2018.07.23
苏嵌 项目实战
学习日志 姓名:张朋 日期:2018年07月23日
今日学习任务 |
|
今日任务完成情况 (详细说明本日任务是否按计划完成,开发的代码量) |
今日任务按计划完成。
|
今日开发中出现的问题汇总 |
|
今日未解决问题 |
无 |
今日开发收获 |
通过今天的学习,让我知道了什么是函数指针变量以及函数指针数组。明白了几个特殊关键字的不同的作用。掌握了几种复合数据类型(结构体、共用体、枚举),同时知道了他们三者的相同之处和不同之处。了解了什么是幻数以及如何避免幻数的出现。懂得了什么是大端字节序、小端字节序。明白了宏函数与自定义函数的区别。 |
自我评价 (是否按开发规范完成既定任务,需要改进的地方,与他人合作效果等) |
今天可以跟上老师的步骤,跟着老师的步伐复习和回顾了之前所讲的内容,感觉自己对有些知识点还是有些陌生,需要课下花些时间进行练习和背诵。同时,根据今天老师所讲的内容来看,有些比较难的知识点没有在课堂上完全掌握,这就要求自己在课后进行询问同学和老师。总的来说,还是需要自己花时间来搞懂今天没有听懂的知识点。 |
其他 |
无 |
1.结构体的相关代码(课堂上练习题)源代码如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>struct student
{int num;char name;char *str;char arr[100];
};
typedef struct student Student;int main()
{Student stu1;Student *stu2;stu2 = &stu1;#if 1stu1.str = (char *)malloc(sizeof(char) * 50);stu1.str = "hello world!!!!!";printf("stu1.str = %s\n",stu1.str);#endifstrcpy(stu2->arr,"hello woeld!!");printf("stu2->arr = %s\n",stu2->arr);printf("stu1.arr = %s\n",stu1.arr);stu1.num = 12;stu1.name ='a';printf("stu1.num = %d stu1.name = %c\n",stu1.num,stu1.name);stu2->num = 23;stu2->name = 'c';printf("stu2->num = %d stu2->name = %c\n",stu2->num,stu2->name);return 0;
}
2.带有static关键字的代码(课堂练习题)
#include <stdio.h>int count = 6;
int func()
{static int num = 5;num++;printf("num = %d\n",num);
}
int main()
{
// static int num = 5;func();func();func();print1();return 0;
}
extern count;
static void print()
{printf("count = %d\n",count);
}
void print1()
{print();
}
4.关于求结构体字长的代码。
#include <stdio.h>struct student
{char name;char sex;int b2;short a1;int num;// char sex;
};typedef struct student Student;
int main()
{Student stu1;printf("sizeof(stu1) = %d\n",sizeof(stu1));return 0;
}
5.带有函数指针和函数指针数组以及回调函数的相关练习。
#include <stdio.h>int add(int a, int b)
{return a + b;
}
int sub(int a, int b)
{return a - b;
}
int mul(int a ,int b)
{return a * b;
}
int div (int a, int b)
{return a / b;
}
int cal(int a, int b,int(*p_cal)(int, int))
{return p_cal(a, b);
}
int main()
{int i;int sum;int (*p_cal_array[4])(int,int);cal(6,5,add);cal(6,5,sub);cal(6,5,mul);cal(6,5,div);printf("add = %d\n",cal(6,5,add));printf("sub = %d\n",cal(6,5,sub));printf("mul = %d\n",cal(6,5,mul));printf("div = %d\n",cal(6,5,div));p_cal_array[0] = add;p_cal_array[1] = sub;p_cal_array[2] = mul;p_cal_array[3] = div;for(i = 0; i < 4; i++){(p_cal_array[i])(6,5);}for(i = 0; i < 4; i++){printf("p_cal_array[%d] = %d\n",i,(p_cal_array[i])(6,5));}return 0;
}
6.共用体的相关练习。
#include <stdio.h>union node
{int num;char ch[2];
};int main()
{union node p;union node *pp = &p;int num1 = 0x12345678;char *ptr = &num1;printf("ptr = %x\n",*ptr);//confirm little or big model,78---little,12---bigp.num = 0;p.ch[0] = 0;p.ch[1] = 1;printf("sizeof(union node) = %d\n",sizeof(union node));printf("num = %d\n",p.num);return 0;
}
苏嵌//张朋//2018.07.23相关推荐
- 苏嵌//张朋//2018.07.13
苏嵌 ...
- 苏嵌//张朋//2018.07.16
苏嵌 ...
- //苏嵌//张朋//2018.07.11
苏嵌 ...
- 苏嵌//张福辉//2018.7.23
苏嵌 ...
- 苏嵌//张福辉//2018.7.13
苏嵌 ...
- 苏嵌//张福辉//2018.7.11
苏嵌 ...
- 苏嵌//张福辉//2018.7.24
苏嵌 ...
- 苏嵌//张福辉//2018.7.27
苏嵌 ...
- 苏嵌学习日志03 07.13
学习日志 姓名:刘易中 日期:2018/07/13 今日学习任务 结构体.结构体和链表.内存管理.关键字union.enum.typedef等. 今日任务完成情况 (详细说明本 ...
最新文章
- JMC | 人工智能在药物合成中的当前和未来作用(3)
- 【Android 逆向】Android 系统文件分析 ( /proc/ 目录文件分析 | 记录系统和进程信息 | version 内核版本信息文件 )
- 【译】How to create your own Question-Answering system easily with python
- ACM-ICPC 2017 Asia Nanning
- mysql索引有字符集_07. 类型、字符集、引擎和索引
- [Python] L1-031. 到底是不是太胖了-PAT团体程序设计天梯赛GPLT
- 2021SC@SDUSC Zxing开源代码(十六)PDF417二维码(二)
- 文件后缀对应文件类型表
- Mac创建一个vue项目
- 双循环背景下的全球供应链机遇与挑战
- linux服务器光衰,交换机、linux光衰查询
- 打造一款最强王者云笔记typora+坚果云+阿里云oss?
- 一网打尽:指针和数组
- redis五种类型的经典使用场景
- Geany 编程工具的使用
- 关于无法显示特殊汉字的问题
- Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (checkstyle-vali
- Simulink三相异步电机仿真(1)
- 安卓项目为什么要clean,以及如何clean
- zynq 7000 clg400 可作为外部AD 的引脚列表
热门文章
- 【观察】维谛技术(Vertiv):数据中心群落化演进,背后的专业价值释放
- 戴尔R730XD服务器的不定时蓝屏研究 蓝屏错误代码 0x00000124
- 随机梯度下降法、牛顿法、冲量法、AdaGrad、RMSprop以及Adam优化过程和理解
- [巩固培元]Python文件操作案例——用户登录
- 为什么说交换机可以隔离冲突域?
- 身为一个SEO/SEM/运营专员,一天的工作是怎样的?
- QueryRunner常用方法
- 真实案例:网站遭遇DOS攻击
- ANSVC无功补偿装置在南京某高等院校中的应用
- 极客日报:王者荣耀道歉:因新游海报擅用原神素材;Facebook改名为Meta;Node.js v16.13.0发布