2015-4-7C语言学习日记

来源:互联网 发布:软件售后服务条款 编辑:程序博客网 时间:2024/05/21 05:23

<>与“”头文件引用的区别

1.         都是文件包含

2.         <>编译时搜索系统默认包含路径,一般都是库函数头文件

3.         #include “xxx.h”  编译时先搜索源代码当前目录,再搜索系统默认包含路径,一般是程序员自己的头文件

 

typedef关键字

typedef int Int2;Int2 a=0;

 

typedef struct

{

       intnum;

       charname[20];

       charsex;

       scoredouble;

}Student;

 

这样声明结构体只要 Student stu;

 

若是

struct Student

{

       intnum;

       charname[20];

       charsex;

       scoredouble;

};

这样的声明就要struct Student stu;

 

typedef struct

{

       intnum;

       charname[20];

       charsex;

       scoredouble;

}Student;

num四字节

name本身是20字节 name的本质是char 所以单元是1

char是1字节

score是8 他的开始地址是4+20+1+(补上7个,因为double的起始地址必须是8的倍数,当前是25 要+7),本身长度是8

 

最后的结果是4+20+1+7+8=40

0 0