程序人生——苏嵌第5天

苏嵌教育                                                                     暑期实习


                                          学习日志                                            姓名:胡昊          日期:2018.7.20



                                                

  • 今日学习任务:                                 学习结构体,链表,共用体,位域。

  • 今日任务完成情况:                         基本完成任务,大体掌握了结构体,共同体。链表尚有不熟。主要代码:
    /*************************************************************************
    	> File Name: test1.c
    	> Author: HuHao
    	> Mail: [email protected] 
    	> Created Time: 2018年07月20日 星期五 03时53分49秒
     ************************************************************************/
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    union note
    {
    	char all[16];
    	struct student
    	{
    		int no[4];
    		char name[8];
    		int grade[4];
    	};
    };
    
    int main()
    {
    	union note stu;
    	strcpy(&stu,"1234huhaobab4321");
    	printf("stu = %s\n",stu.all);
    	return 0;
    }
    
    /*************************************************************************
    	> File Name: LinkList.c
    	> Author: HuHao
    	> Mail: [email protected] 
    	> Created Time: 2018年07月20日 星期五 21时10分56秒
     ************************************************************************/
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #define OK 1
    #define ERROR 0
    #define TRUE 1
    #define FALSE 0
    
    #define MAXSIZE 20 /* 存储空间初始分配量 */
    
    typedef int Status;/* Status是函数的类型,其值是函数结果状态代码,如OK等 */
    typedef int ElemType;/* ElemType类型根据实际情况而定,这里假设为int */
    
    typedef struct Node
    {
    	    ElemType data;
    		struct Node *next;
    }Node;
    
    typedef struct Node * LinkList; /* 定义LinkList */
    
    /*定义输出函数*/
    Status visit(ElemType c)
    {
    	printf("%d\n",c);
    	return OK;
    }
    
    /* 初始化链表 */
    Status InitList(LinkList *L)
    {
    	*L=(LinkList)malloc(sizeof(Node));/* 产生头结点,并使L指向此头结点 */
    	if(NULL == (*L))/* 存储分配失败 */
    		return ERROR;
    	(*L)->next=NULL;/* 指针域为空 */
    	return OK;
    }
    
    int main()
    {
    	return 0;
    }
    	
    

  • 今日开发中出现的问题汇总:        结构体,共用体,位域的定义以及使用,链表的操作。

  • 今日未解决问题:                          链表的操作

  • 自我评价:                                     自我感觉良好,基本掌握了新知识。

  • 其他:                                            随着一天的学习落幕,收获满满,期待着明天的学习和明天的收获。
发布了9 篇原创文章 · 获赞 2 · 访问量 652

猜你喜欢

转载自blog.csdn.net/a45654645/article/details/81138995
今日推荐