Struct (C programming language)

A struct in the C programming language (and many derivatives) is a composite data type (or record) declaration that defines a physically grouped list of variables under one name in a block of memory, allowing the different variables to be accessed via a single pointer or by the struct declared name which returns the same address. The struct data type can contain other data types so is used for mixed-data-type records such as a hard-drive directory entry (file length, name, extension, physical address, etc.), or other mixed-type records (name, address, telephone, balance, etc.).

Comment
enA struct in the C programming language (and many derivatives) is a composite data type (or record) declaration that defines a physically grouped list of variables under one name in a block of memory, allowing the different variables to be accessed via a single pointer or by the struct declared name which returns the same address. The struct data type can contain other data types so is used for mixed-data-type records such as a hard-drive directory entry (file length, name, extension, physical address, etc.), or other mixed-type records (name, address, telephone, balance, etc.).
Has abstract
enA struct in the C programming language (and many derivatives) is a composite data type (or record) declaration that defines a physically grouped list of variables under one name in a block of memory, allowing the different variables to be accessed via a single pointer or by the struct declared name which returns the same address. The struct data type can contain other data types so is used for mixed-data-type records such as a hard-drive directory entry (file length, name, extension, physical address, etc.), or other mixed-type records (name, address, telephone, balance, etc.). The C struct directly references a contiguous block of physical memory, usually delimited (sized) by word-length boundaries. It corresponds to the similarly named feature available in some assemblers for Intel processors. Being a block of contiguous memory, each field within a struct is located at a certain fixed offset from the start. Because the contents of a struct are stored in contiguous memory, the sizeof operator must be used to get the number of bytes needed to store a particular type of struct, just as it can be used for primitives. The alignment of particular fields in the struct (with respect to word boundaries) is implementation-specific and may include padding, although modern compilers typically support the #pragma pack directive, which changes the size in bytes used for alignment. In the C++ language, a struct is identical to a C++ class but has a different default visibility: class members are private by default, whereas struct members are public by default.
Hypernym
Declaration
Is primary topic of
Struct (C programming language)
Label
enStruct (C programming language)
Link from a Wikipage to another Wikipage
Access modifiers
ALGOL 68
Assembly language
Bit field
C++
C++ classes
Category:C (programming language)
Class (computer programming)
Composite data type
C programming language
C Sharp (programming language)
Dereference operator
Flexible array member
Passive data structure
Pointer (computer programming)
Primitive data type
Record (computer science)
Sizeof
Static memory allocation
Typedef
Union type
Visual Basic .NET
Word (computer architecture)
SameAs
C programlama dilinde struct
DZHc
m.06w47hq
Q1164699
Struct
Struct
Struct (C programming language)
Struct (زبان برنامه‌نویسی سی)
Struktur (Datentyp)
Struktura (programovací jazyk C)
Struktura (programowanie)
Структура (язык Си)
構造体
结构体 (C语言)
Subject
Category:C (programming language)
WasDerivedFrom
Struct (C programming language)?oldid=1066966759&ns=0
WikiPageLength
7654
Wikipage page ID
992538
Wikipage revision ID
1066966759
WikiPageUsesTemplate
Template:Lowercase
Template:Reflist