1.整理思维导图
2.把上课没做完的结构体大小求完(写出过程)
3.把枚举部分的练习题,再做一遍
4.三种验证大小端存储大的代码写一遍
1.思维导图在最后
 2.结构体大小
struct data{                1233000044444444,16字节
char t1;
 char t2;
 unsigned short t3;
 unsigned long t4;
 };
struct data{                100022223300,12字节
char t1;
 int t2;
 short t3;
 };
struct s1                      100022223000,12字节
{
 char c1;
 int i;
 char c2;
 };
struct s2                       12003333,8字节
{
 char c1;
 char c2;
 int i;
 };
typedef struct Test       1100000000002222222222223333,28字节
 {
 short a;
         struct                    111122223000,12字节
         {
         int b;
         double c;
         char d;
         }p;
 int e;
 }Test;
typedef struct Test            2+6+96+4+4,112字节
 {
 short a;
         struct                         4+4+80+1+7,96字节
         {
         int b;
         double c[10];
         char d;
         };
 int e;
 }Test;
struct c{                100022223300,12字节
 char b;
 int a;
 short c;
 };
struct c{                12223,5字节
 char a;
 char b[3];
 char c;
 };
typedef struct        4+1+3+8+1+3+4+8,32字节
 {
 int b;
 char a;
 long e;
 char c;
 float d;
 double t;
 }node;
3.枚举
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <math.h>
 typedef enum
 {
     LED_1,
     LED_2,
     LED_3
 }LED;
 typedef enum
 {
     ON,
     OFF
 }LED_CON;
 void init(LED L)
 {
     switch(L)
     {
         case LED_1:
             printf("初始化了LED_1灯\n");
             break;    
         case LED_2:
             printf("初始化了LED_2灯\n");
             break;
         case LED_3:
             printf("初始化了LED_3灯\n");
             break;
     }
 }
 void con(LED L,LED_CON C)
 {
     switch(L)
     {
         case LED_1:
             switch(C)
             {
                 case ON:
                     printf("打开了LED_1灯\n");
                     break;
             }
             break;    
         case LED_2:
             switch(C)
             {
                 case ON:
                     printf("打开了LED_2灯\n");
                     break;
             }
             break;    
         case LED_3:
             switch(C)
             {
                 case ON:
                     printf("打开了LED_3灯\n");
                     break;
             }
             break;    
     }
 }
 int main(int argc, const char *argv[])
 {
     init(LED_1);
     con(LED_2,ON);
     return 0;
 }
4.大小端存储
一、
 int a=0x12345678;
char c=(char)a;
if(c==0x12)
{
printf("大端存储\n");
}else{
printf("小端存储\n");
}
二、
typedef union
{
short a;
char c;
}A;
A u.a=0x1234
if(u.c==0x12)
{
printf("大端存储\n");
}else{
printf("小端存储\n");
}
