收藏 分享(赏)

C语言编程学习课件 (52).pdf

上传人:职教中国 文档编号:13894385 上传时间:2022-11-06 格式:PDF 页数:8 大小:951.24KB
下载 相关 举报
C语言编程学习课件 (52).pdf_第1页
第1页 / 共8页
C语言编程学习课件 (52).pdf_第2页
第2页 / 共8页
C语言编程学习课件 (52).pdf_第3页
第3页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、Programming In C Contents 01 02 how to use members in structure variables Memory alignment The dot here is called member operator. How to use members in structure variables The form of referencing a member in a structure variable is: structure variable names. member names How to use members in struc

2、ture variables A structure variable to be directly assigned to another structure variable, with the same structure. s2= s1; The assignment of the structure uses the method the memory copy the individual member copy int a10; Int b10; a=b; struct example int a3; array1,array2; Array1=0,1,2; array2=arr

3、ay1; struct memnumber int a; double b; char c; number1; /take up 4 bytes /take up 8 bytes /take up 1 bytes sizeof( number1) !=13 sizeof( number1) =24 memory alignment Memory alignment There is a requirement for the storage location of variables in memory in many systems. That is the addresses storin

4、g the structure objects and their members are multiples of a certain number. This is the structure memory alignment principle. In order to meet this principle, compiler fill in bytes between members . Memory alignment 成员 a 成员 b 成员c take up 4 bytes fill in 4 bytes take up 8 bytes take up 1 bytes fill in 7 bytes Example struct memnumber int a; char c; double b; number1; Programming In C

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 大学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报