0% found this document useful (0 votes)
29 views9 pages

Structure: Lesson 4

A structure defines a grouped list of variables that are stored together in memory under one name. It allows different variables to be accessed using a single pointer. Structures can hold variables of different data types, allowing programs to create objects with different attribute types. Structure members are accessed using the dot operator between the structure variable name and member name.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views9 pages

Structure: Lesson 4

A structure defines a grouped list of variables that are stored together in memory under one name. It allows different variables to be accessed using a single pointer. Structures can hold variables of different data types, allowing programs to create objects with different attribute types. Structure members are accessed using the dot operator between the structure variable name and member name.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

STRUCTURE

Lesson 4
Structure
• A structure is a composite data type that defines a grouped list of variables that are to
be placed under one name in a block of memory.
• It allows different variables to be accessed by using a single pointer to the structure.
•  a composite data type (or record) declaration that defines a physically grouped list of
variables to be placed under one name in a block of memory, allowing the different
variables to be accessed via a single pointer, or the struct declared name which returns
the same address. 
•  struct directly references a contiguous block of physical memory, usually delimited
(sized) by word-length boundaries.
syntax
struct structure_name   
{  
    data_type member1;  
    data_type member2;  
    .  
    .  
    data_type memeber;  
};  
Advantage
• It can hold variables of different data types.
• We can create objects containing different types of attributes.
• It allows us to re-use the data layout across programs.
• It is used to implement other data structures like linked lists, stacks,
queues, trees, graphs etc.
Accessing Structure Members
To access any member of a structure, we use the member access operator
(.). The member access operator is coded as a period between the structure
variable name and the structure member that we wish to access.
Array
Lesson 5
Array
• Arrays are defined as the collection of similar type of data items stored at
contiguous memory locations.
• Arrays are the derived data type in C programming language which can
store the primitive type of data such as int, char, double, float, etc.
• Array is the simplest data structure where each data element can be
randomly accessed by using its index number.

You might also like