SlideShare a Scribd company logo
Structures-in-C programming with examples
A structure is a collection of variables under a single name. These variables can be of
different types, and each has a name which is used to select it from the structure
Structure is a user-defined data type in C which allows you to combine different data
types to store in a new type
Structures helps to construct complex data types in more meaningful way.
Structure is some what similar to Array. The only different is that array is used to
store collection of similar data types while structure can store collection of any type
of data.
A structure is a user defined data type that groups logically related data items of
different data types into a single unit.
Suppose you want to store record of Student which consists of name,
address, roll number and age.
Structure is used to represent a record.
Suppose you want to store record of Book which consists of book
name, pages, price & author name.
All the elements of a structure are stored at contiguous memory locations.
A variable of structure type can store multiple data items of different data types
under the one name.
As the data of employee in company that is name, Employee ID, salary, address, phone
number is stored in structure data type.
We use ‘struct’ keyword to define a structure in C.
struct structureName
{
datatype variableName1;
datatype variableName2;
.
.
};
Syntax New Datatype name
Structure must end with
semicolon
Structure
Members
Suppose you want to store record of Student which consists of name,
address, roll number and age.
struct Student
{
char studName[15];
chat address[30];
int rollNumber;
int age;
};
Example
New Datatype name
Suppose you want to store record of Book which consists of book
name, pages, price & author name.
struct Book
{
char bookName[15];
chat author[30];
int pages;
float price;
};
Example
New Datatype name
Suppose you want to store record of Employee which consists of
name, ID, salary, address & dept.
struct Employee
{
int emp_id;
char empName[15];
chat address[30];
char dept[3]
float salary;
};
Example
New Datatype name
Ad

Recommended

PPTX
Structure prespentation
ashu awais
 
PPTX
Structures in c language
tanmaymodi4
 
PPTX
Structures in c language
Tanmay Modi
 
PPT
2 lesson 2 object oriented programming in c++
Jeff TUYISHIME
 
PDF
Lk module4 structures
Krishna Nanda
 
PPTX
DS_Lecture_05.1_05.2.pptxnjnshsgxdhdgcdhcbdhc
nafizahmedsabed2
 
PDF
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
PPT
Lecture 04
12802007
 
PDF
structure and union1.pdf
HMCollegeInfo
 
PPTX
C programing -Structure
shaibal sharif
 
PPTX
Introduction of structure (2)
Jatin Sharma
 
DOCX
C UNIT-4 PREPARED BY M V BRAHMANANDA RE
Rajeshkumar Reddy
 
PPTX
Programming in C
MalathiNagarajan20
 
PDF
Chapter 13.1.9
patcha535
 
PPT
Lecture number three Structures (1).ppt
shahbazqadeer1
 
PDF
fundamental programming languagech#2 (3).pdf
gemchisgetahun
 
PPTX
Definition, Declaration of Structures in C.pptx
AnithaTAssistantProf
 
PPTX
Structures
selvapon
 
PPTX
CPU : Structures And Unions
Dhrumil Patel
 
PPTX
C Structures and Unions
Dhrumil Patel
 
DOCX
Str
Acad
 
PDF
Structures in c++
Swarup Boro
 
PPT
Lecture 19 - Struct and Union
Md. Imran Hossain Showrov
 
PPTX
Chapter4.pptx
WondimuBantihun1
 
PPTX
oop Lecture 1
Atif Khan
 
DOCX
Structure and Typedef
Acad
 
DOCX
PPS 8.8.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.)
Sitamarhi Institute of Technology
 
PPTX
17 structure-and-union
Rohit Shrivastava
 
PPT
c-Functions power point presentation on c functions
10300PEDDIKISHOR
 
PPT
c-step-by-step-execution power point presentation
10300PEDDIKISHOR
 

More Related Content

Similar to Structures-in-C programming with examples (20)

PDF
structure and union1.pdf
HMCollegeInfo
 
PPTX
C programing -Structure
shaibal sharif
 
PPTX
Introduction of structure (2)
Jatin Sharma
 
DOCX
C UNIT-4 PREPARED BY M V BRAHMANANDA RE
Rajeshkumar Reddy
 
PPTX
Programming in C
MalathiNagarajan20
 
PDF
Chapter 13.1.9
patcha535
 
PPT
Lecture number three Structures (1).ppt
shahbazqadeer1
 
PDF
fundamental programming languagech#2 (3).pdf
gemchisgetahun
 
PPTX
Definition, Declaration of Structures in C.pptx
AnithaTAssistantProf
 
PPTX
Structures
selvapon
 
PPTX
CPU : Structures And Unions
Dhrumil Patel
 
PPTX
C Structures and Unions
Dhrumil Patel
 
DOCX
Str
Acad
 
PDF
Structures in c++
Swarup Boro
 
PPT
Lecture 19 - Struct and Union
Md. Imran Hossain Showrov
 
PPTX
Chapter4.pptx
WondimuBantihun1
 
PPTX
oop Lecture 1
Atif Khan
 
DOCX
Structure and Typedef
Acad
 
DOCX
PPS 8.8.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.)
Sitamarhi Institute of Technology
 
PPTX
17 structure-and-union
Rohit Shrivastava
 
structure and union1.pdf
HMCollegeInfo
 
C programing -Structure
shaibal sharif
 
Introduction of structure (2)
Jatin Sharma
 
C UNIT-4 PREPARED BY M V BRAHMANANDA RE
Rajeshkumar Reddy
 
Programming in C
MalathiNagarajan20
 
Chapter 13.1.9
patcha535
 
Lecture number three Structures (1).ppt
shahbazqadeer1
 
fundamental programming languagech#2 (3).pdf
gemchisgetahun
 
Definition, Declaration of Structures in C.pptx
AnithaTAssistantProf
 
Structures
selvapon
 
CPU : Structures And Unions
Dhrumil Patel
 
C Structures and Unions
Dhrumil Patel
 
Str
Acad
 
Structures in c++
Swarup Boro
 
Lecture 19 - Struct and Union
Md. Imran Hossain Showrov
 
Chapter4.pptx
WondimuBantihun1
 
oop Lecture 1
Atif Khan
 
Structure and Typedef
Acad
 
PPS 8.8.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.)
Sitamarhi Institute of Technology
 
17 structure-and-union
Rohit Shrivastava
 

More from 10300PEDDIKISHOR (7)

PPT
c-Functions power point presentation on c functions
10300PEDDIKISHOR
 
PPT
c-step-by-step-execution power point presentation
10300PEDDIKISHOR
 
PPTX
file handling in c programming with file functions
10300PEDDIKISHOR
 
PPT
Unity JDBC ICEIS ppt UnityJDBC ICEIS ppt
10300PEDDIKISHOR
 
PPT
JDBC DriversPros and Cons of Each Driver
10300PEDDIKISHOR
 
PPT
Java Database Connectivity Java Database
10300PEDDIKISHOR
 
PDF
Every SQL Query must have: • SELECT clause: specifies columns to be retained ...
10300PEDDIKISHOR
 
c-Functions power point presentation on c functions
10300PEDDIKISHOR
 
c-step-by-step-execution power point presentation
10300PEDDIKISHOR
 
file handling in c programming with file functions
10300PEDDIKISHOR
 
Unity JDBC ICEIS ppt UnityJDBC ICEIS ppt
10300PEDDIKISHOR
 
JDBC DriversPros and Cons of Each Driver
10300PEDDIKISHOR
 
Java Database Connectivity Java Database
10300PEDDIKISHOR
 
Every SQL Query must have: • SELECT clause: specifies columns to be retained ...
10300PEDDIKISHOR
 
Ad

Recently uploaded (20)

PDF
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
PDF
Modern multi-proposer consensus implementations
François Garillot
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PDF
Complete guidance book of Asp.Net Web API
Shabista Imam
 
PDF
International Journal of Advanced Information Technology (IJAIT)
ijait
 
PPTX
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
PPTX
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
PDF
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
PPTX
Mobile database systems 20254545645.pptx
herosh1968
 
PDF
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
PPTX
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
PPTX
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
PDF
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
PDF
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
PPTX
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
PPTX
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
PDF
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
PDF
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Modern multi-proposer consensus implementations
François Garillot
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Complete guidance book of Asp.Net Web API
Shabista Imam
 
International Journal of Advanced Information Technology (IJAIT)
ijait
 
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
Mobile database systems 20254545645.pptx
herosh1968
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
تقرير عن التحليل الديناميكي لتدفق الهواء حول جناح.pdf
محمد قصص فتوتة
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Industrial internet of things IOT Week-3.pptx
KNaveenKumarECE
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
Ad

Structures-in-C programming with examples

  • 2. A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure Structure is a user-defined data type in C which allows you to combine different data types to store in a new type Structures helps to construct complex data types in more meaningful way. Structure is some what similar to Array. The only different is that array is used to store collection of similar data types while structure can store collection of any type of data. A structure is a user defined data type that groups logically related data items of different data types into a single unit.
  • 3. Suppose you want to store record of Student which consists of name, address, roll number and age. Structure is used to represent a record. Suppose you want to store record of Book which consists of book name, pages, price & author name.
  • 4. All the elements of a structure are stored at contiguous memory locations. A variable of structure type can store multiple data items of different data types under the one name. As the data of employee in company that is name, Employee ID, salary, address, phone number is stored in structure data type.
  • 5. We use ‘struct’ keyword to define a structure in C. struct structureName { datatype variableName1; datatype variableName2; . . }; Syntax New Datatype name Structure must end with semicolon Structure Members
  • 6. Suppose you want to store record of Student which consists of name, address, roll number and age. struct Student { char studName[15]; chat address[30]; int rollNumber; int age; }; Example New Datatype name
  • 7. Suppose you want to store record of Book which consists of book name, pages, price & author name. struct Book { char bookName[15]; chat author[30]; int pages; float price; }; Example New Datatype name
  • 8. Suppose you want to store record of Employee which consists of name, ID, salary, address & dept. struct Employee { int emp_id; char empName[15]; chat address[30]; char dept[3] float salary; }; Example New Datatype name