what is a struct in c

what is a struct in c

1 year ago 57
Nature

In C programming, a struct (short for "structure") is a composite data type 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 name itself). A struct is a way to group several related variables into one place, and each variable in the structure is known as a member of the structure. Unlike an array, a structure can contain many different data types (int, float, char, etc.). To define a struct, the struct keyword is used followed by the tag name of the structure, and then the body of the structure is defined, in which the required data members (primitive or user-defined data types) are added. To access members of a structure, use the dot syntax ( . ). Structures are used to represent a record, and they can be used to create data structures such as trees, linked lists, etc..

Read Entire Article