苏嵌                                                                                                                                   项目实战

学习日志                                       姓名:张朋                       日期:2018年07月23日

今日学习任务

  1. 回顾了前几天的学习内容(主要包括什么是指针、为什么提出指针这种类型、多维指针的作用、什么是野指针、如何避免野指针、函数的三要素、传值和传地址的区别、数组的相关知识等)
  2. 学习了什么是函数指针以及定义方式和使用方式。
  3. 学习了什么是函数指针数组、怎么使用、了解了什么情况下用函数指针数组。
  4. 讲了几个关键字(register、static、extern、const、typedef)的作用。
  5. 学习了几个复合数据类型(结构体、共用体(联合体)、枚举)
  6. 了解并掌握什么是内存空洞。
  7. 掌握几种基本语句的用法(switch、break、continue、goto语句)等。

今日任务完成情况

(详细说明本日任务是否按计划完成,开发的代码量)

今日任务按计划完成。

  1. 掌握了什么是函数指针、什么是函数指针数组。
  2. 掌握了几个关键字的作用(register、static、extern、const、typedef)
  3. 对结构体、共用体、枚举有了比较全面的认识。
  4. 懂得了什么是内存空洞、什么是幻数等有关知识点。

今日开发中出现的问题汇总

  1. typedef和define的区别?
  2. 如何修改编译器的对齐方式?
  3. 怎么避免幻数?
  4. 宏函数与自定义函数那个效率更高?(两者哪个更好?)
  5. continue和break的区别?

今日未解决问题

今日开发收获

通过今天的学习,让我知道了什么是函数指针变量以及函数指针数组。明白了几个特殊关键字的不同的作用。掌握了几种复合数据类型(结构体、共用体、枚举),同时知道了他们三者的相同之处和不同之处。了解了什么是幻数以及如何避免幻数的出现。懂得了什么是大端字节序、小端字节序。明白了宏函数与自定义函数的区别。

自我评价

(是否按开发规范完成既定任务,需要改进的地方,与他人合作效果等)

今天可以跟上老师的步骤,跟着老师的步伐复习和回顾了之前所讲的内容,感觉自己对有些知识点还是有些陌生,需要课下花些时间进行练习和背诵。同时,根据今天老师所讲的内容来看,有些比较难的知识点没有在课堂上完全掌握,这就要求自己在课后进行询问同学和老师。总的来说,还是需要自己花时间来搞懂今天没有听懂的知识点。

其他

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相关推荐

  1. 苏嵌//张朋//2018.07.13

    苏嵌                                                                                                   ...

  2. 苏嵌//张朋//2018.07.16

    苏嵌                                                                                                   ...

  3. //苏嵌//张朋//2018.07.11

    苏嵌                                                                                                   ...

  4. 苏嵌//张福辉//2018.7.23

    苏嵌                                                                                                   ...

  5. 苏嵌//张福辉//2018.7.13

    苏嵌                                                                                                   ...

  6. 苏嵌//张福辉//2018.7.11

    苏嵌                                                                                                   ...

  7. 苏嵌//张福辉//2018.7.24

    苏嵌                                                                                                   ...

  8. 苏嵌//张福辉//2018.7.27

    苏嵌                                                                                                   ...

  9. 苏嵌学习日志03 07.13

    学习日志      姓名:刘易中      日期:2018/07/13 今日学习任务 结构体.结构体和链表.内存管理.关键字union.enum.typedef等.   今日任务完成情况 (详细说明本 ...

最新文章

  1. JMC | 人工智能在药物合成中的当前和未来作用(3)
  2. 【Android 逆向】Android 系统文件分析 ( /proc/ 目录文件分析 | 记录系统和进程信息 | version 内核版本信息文件 )
  3. 【译】How to create your own Question-Answering system easily with python
  4. ACM-ICPC 2017 Asia Nanning
  5. mysql索引有字符集_07. 类型、字符集、引擎和索引
  6. [Python] L1-031. 到底是不是太胖了-PAT团体程序设计天梯赛GPLT
  7. 2021SC@SDUSC Zxing开源代码(十六)PDF417二维码(二)
  8. 文件后缀对应文件类型表
  9. Mac创建一个vue项目
  10. 双循环背景下的全球供应链机遇与挑战
  11. linux服务器光衰,交换机、linux光衰查询
  12. 打造一款最强王者云笔记typora+坚果云+阿里云oss?
  13. 一网打尽:指针和数组
  14. redis五种类型的经典使用场景
  15. Geany 编程工具的使用
  16. 关于无法显示特殊汉字的问题
  17. Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (checkstyle-vali
  18. Simulink三相异步电机仿真(1)
  19. 安卓项目为什么要clean,以及如何clean
  20. zynq 7000 clg400 可作为外部AD 的引脚列表

热门文章

  1. 【观察】维谛技术(Vertiv):数据中心群落化演进,背后的专业价值释放
  2. 戴尔R730XD服务器的不定时蓝屏研究 蓝屏错误代码 0x00000124
  3. 随机梯度下降法、牛顿法、冲量法、AdaGrad、RMSprop以及Adam优化过程和理解
  4. [巩固培元]Python文件操作案例——用户登录
  5. 为什么说交换机可以隔离冲突域?
  6. 身为一个SEO/SEM/运营专员,一天的工作是怎样的?
  7. QueryRunner常用方法
  8. 真实案例:网站遭遇DOS攻击
  9. ANSVC无功补偿装置在南京某高等院校中的应用
  10. 极客日报:王者荣耀道歉:因新游海报擅用原神素材;Facebook改名为Meta;Node.js v16.13.0发布