0% found this document useful (0 votes)
14 views

Structures-in-C-Programming

Uploaded by

mohanakshayvarma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Structures-in-C-Programming

Uploaded by

mohanakshayvarma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Structures in C

Programming
This presentation will explore the fundamentals of structures in
programming, discussing their definition, use cases, and practic
applications.

maladi laxmi Sneha 24VE1A05LY


Lt B .koushik 24VE1A05LT
MC Mohammad Riyaz 24VE1A05MC
Na S.Abhishek 24VE1A05NA
What is a Structure?
A structure is a user-defined data type in C that allows For instance, you could define a structure to represent
you to group together variables of different data types a student, storing their name, roll number, and marks
under a single name. Think of it as a blueprint for for different subjects. Each variable within the structure
creating custom data objects that represent a real- is called a member.
world entity.
Why Use Structures?

1 Organize Related Improve Code


2 3 Simplify Complex Data Handling
Data Reusability

Structures provide a You can define a structure


Instead of dealing with individual
structured way to once and use it multiple
variables, you can work with entire
organize and manage times throughout your
structures as a single unit, simplifying
related data, making your code, reducing
complex data handling tasks.
code more readable and redundancy and
maintainable. promoting code reuse.
Declaring a Structure
struct student {
char name[50];
int roll_no;
float marks;
};

The struct keyword is used to declare a structure. You then give it


a name (e.g., student) and define its members within curly
braces. Each member has a name and a data type.
Accessing Structure Members
To access a member of a structure, you use the dot (.)
struct student s1;
operator. The syntax is s1.name = "John Doe";
structure_variable.member_name. s1.roll_no = 10;
s1.marks = 85.5;
Initializing Structures
Direct Initialization Member-by-Member Initialization

struct student s1 = { "John Doe", 10, struct student s1;


85.5 }; s1.name = "John Doe";
s1.roll_no = 10;
s1.marks = 85.5;
Arrays of Structures

Declaring an Array of Accessing Members


Structures
students[0].name =
struct student "Alice";
students[100]; students[1].roll_no =
20;
Structures within Structures
Outer Structure
1 Contains the main data

Inner Structure
2
Represents a related sub-entity

You can define structures within other structures, allowing you to create complex data models to represent intricate
relationships between data elements.
Practical Applications of Structures
Data Management
1 Databases, spreadsheets, and other data management systems heavily rely on structures to
organize and store data efficiently.

Graphics and Game Development


2 Structures are used to represent objects, characters, and game
elements, enabling sophisticated graphics and game mechanics.

Networking and Communication


Structures help define network protocols, packet
3
formats, and data structures used in communication
between devices.
THANK YOU
maladi laxmi Sneha 24VE1A05LY
Lt B .koushik 24VE1A05LT
MC Mohammad Riyaz 24VE1A05MC
Na S.Abhishek 24VE1A05NA

You might also like