tailieunhanh - Article on structure padding in C language

This paper is discussing about structures and the memory sizes which is required by the data members, the structure is holding more number of bytes than actual required number of bytes. This is also called as structure Padding. Here the way to reduce the memory size required for the members of the structure. | ISSN:2249-5789 V Swetha et al, International Journal of Computer Science & Communication Networks,Vol 6(1),18-20 ARTICLE ON STRUCTURE PADDING IN C LANGUAGE Bharat institute of Engineering and Technology Asst professor of department of CSE Bharat institute of Engineering and Technology Bharat institute of Engineering and Technology Asst professor of department of CSE Asst professor of department of CSE ABSTRACT —Programming language is important because it defines the relationship, semantics and grammar which allows the programmers to effectively communicate with the machines that they program. C is one of the foundations for modern information technology (IT) and computer science (CS). Many working principles of IT and CS, such as programming languages, computer architectures, operating systems, network communication, real-time systems, device drivers, algorithms, numerical analysis, and computer game are based on or reflected in the functionalities and features of C. C is the language of choice for programming embedded and mechatronic systems with hardware interfaces. This paper is discussing about structures and the memory sizes which is required by the data members, the structure is holding more number of bytes than actual required number of bytes. This is also called as structure Padding. Here the way to reduce the memory size required for the members of the structure. Keywords: structure Padding, Pragma : Structure is the user-define datatype in C. And it is a collection of variables of different types under a single name for better handling. The memory allotted for structure is a combination of individual sizes of members of the structure. Ex: Struct student { int id1,id2; char a,b; float percentage; } record1; Here record1 is a variable of student type, the size of record1 is 4+4+1+1+4=14 bytes(32 bit compiler int - 4 byte memory) But in the following program the size of record1 variable is showing 16 .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.