学习日志 苏浩

苏嵌                                                                                                                  项目实战

学习日志                                         姓名:苏浩                                                      日期:0723

 

 

 

 

今日学习任务

 

1、 熟练掌握所有关键字的使用;(static、extern、typedef)

2、 熟练掌握复合数据类型的使用;(struct、union、enum)

3、 熟练掌握宏的使用技巧;(宏的技巧及宏函数的定义)

4、 编程技巧总结

今日任务完成情况

 

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

  1. 了解函数指针,函数指针数组
  2. 了解掌握所有关键字的使用;(static、extern、typedef)
  3. 了解掌握复合数据类型的使用;(struct、union、enum)
  4. 熟练掌握宏的使用技巧;(宏的技巧及宏函数的定义

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

 

刚使用关键字时,容易用错范围,导致编译错误

 

今日未解决问题

 

今日开发收获

了解了C语言中的关键字register, static,extern,const,typedef 的使用,掌握结构体,共用体和枚举类型的使用,还熟悉了各种判断与循环语句,if,while,switch

 

自我评价

 

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

 

 

通过今天的学习,将C语言的剩下的知识进行补充,对C语言有了更全面的了解,但很多方面还掌握不牢固,需要多练习,加强自己的C语言各个方面的能力

其他

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

#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()

{

    cal(5,6,add);

    cal(5,6,sub);

    cal(5,6,mul);

    cal(5,6,div);

 

    int (*p_cal_array[4])(int, int);

 

    p_cal_array[0] = add;

    p_cal_array[1] = sub;

    p_cal_array[2] = mul;

    p_cal_array[3] = div;

 

    int i;

 

    for(i = 0; i < 4; i++)

    {

        (*p_cal_array[i])(5,6);

    }

   

    int num = p_cal_array[1](5,6);

    printf("result = %d\n",num);

    return 0;

}

 

 

#include <stdio.h>

 

struct node

{

   int num;

   char ch;

   short a;

 

};

typedef struct node Node;

 

int main()

{

    Node p;

 

    printf("sizeof(p) = %d\n",sizeof(p));

 

    return 0;

}

 

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

struct info

{

    int num;

    char ch;

    char *ptr;

};

 

typedef struct info INFO;

 

int main()

{

    INFO p;

   

    p.num = 1;

    p.ch = 'a';

 

    p.ptr = (char *)malloc(sizeof(char) *100);

    strcpy(p.ptr , "hello world");

 

    printf("num = %d ch = %c\n",p.num, p.ch);

    printf("ptr = %s\n",p.ptr);

 

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值