SlideShare a Scribd company logo
STRUCTURE
Prepared By: Jay R. Patel
Enrollment no.:160410119071
Id. No.:16bemev137
Mechanical-2
Batch: C
Guided By: Uma Dave
Basic Of Structure
 Structure is a collection of different types of
variables under a single name.
 Structure is used to represent logically related
data.
 It is same as records used in “PASCAL”.
 The structure is a very powerful and important
tool which fulfills requirements of complex
problems.
 A simple example of a structure is information
about students,
** students can be represented by roll-no,
name, branch, joining date etc.
** It may be possible that a variable in the
structure is also can be structure.
i.e. A variables in structure can be also
devided into components.
For example, one variable ‘joining date’ of
student which consist the date, month and
year which are also variables.
 The general format to define a structure is given
as:
struct_tag {
data_type member_variabe1;
data_type member_variabe2;
.
.
.
} s1,s2,s3;
Defining Of Structure & Members
*** In previous slide ,
 struct is a reserve word and used to define a
structure.
 struct_tag is an optional tag which provides type
name to the structure.
 The members of structures are enclosed in pair of
{}.
 Each member consist of a datatype and variable
name followed by semicolon(;).
 After making declaration variables of student type
are created as follows:
struct student s1,s2,s3;
 The defination(declaration) is ended with
semicolon(;).
 Then cosider following example of a
structure, defining a student record,
struct student {
int roll_no;
char name[20];
int age;
} s1,s2,s3;
 Members of a structure can be accessed and used
individually in a problem.
 Following syntax is used to access the members of a
structure.
 structure_name is the name of a structure variable &
member_name is the name of the member of structure. &
structure member operator “.” (dot) connects member
name to structure name.
for example,
s1.age
Here, s1 is structure variable and age is member name
which is type of student.
And following statement assigns value 20 to s1.age
s1.age = 20;
Accessing Structure Members
Structure_name.member_name
 The Age of student s1 can be read from
keyboard as
scanf(“%d”,&s1.age);
 Following examples shows the use of structure
members in various statements:
1. s2.roll_no = 10;
2. (s2.roll_no)++;
3. printf(“%d”,s1.roll_no);
4. strcpy(s1.name,”akshat”);
5. printf(“%s”,s1.name);
 A structure can be member of another structure. This is
known as nesteding of structure or structure within
structure.
 Consider the student record includes birth date. It is define as
follows:
struct date {
int d;
int m;
int y;
};
struct student {
int roll_no;
char name[20];
struct date birth_date;
};
 student is a variable, then day of birth define as:
s1.birth_date.d
which represents one integer.
Nested Structures
•In previous slide the structure is also be written as :
struct student {
int roll_no;
char name[20];
struct date {
int d;
int m;
int y;
} birth_date;
};
 In this defination, date is part of student and its variables can not be
created independently.
 However, it looks like natural nesting.
 The tag name date can be define in this case without any loss.
Structure for cpu

More Related Content

PPTX
Relational database intro for marketers
PDF
Lk module4 structures
PDF
Chapter15 structure
DOCX
Bt0066 dbms
PPT
Structure c
PDF
Dbms 2: Data Model
PDF
Integrity constraints
Relational database intro for marketers
Lk module4 structures
Chapter15 structure
Bt0066 dbms
Structure c
Dbms 2: Data Model
Integrity constraints

What's hot (11)

PPT
Dbms relational model
PDF
Database Languages
DOCX
Oracle soa xml faq
PDF
Data Abstraction
PPTX
Presentation on c programing satcture
PDF
Lecture18 structurein c.ppt
PPTX
SQL Queries Information
TXT
Impquest2
PPT
Presentation on structure,functions and classes
PPTX
Unit 9. Structure and Unions
Dbms relational model
Database Languages
Oracle soa xml faq
Data Abstraction
Presentation on c programing satcture
Lecture18 structurein c.ppt
SQL Queries Information
Impquest2
Presentation on structure,functions and classes
Unit 9. Structure and Unions
Ad

Similar to Structure for cpu (20)

DOC
Unit 5 (1)
PPTX
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
PPTX
detail structure presentation of problem solving
PDF
unit 5.pdf structure pdf is here you can do this
PPTX
Fundamentals of Structure in C Programming
PPTX
Structure in C
PDF
1. structure
PPTX
Structures
PPTX
Data Structures and Algorithms_Updated.pptx
PPTX
Structure in C language
PPTX
Module 5-Structure and Union
PPTX
Structure.pptx Structure.pptxStructure.pptxStructure.pptxStructure.pptxStruct...
PPTX
Structures in c language
PPTX
Structures in c language
PPTX
Structure prespentation
PPT
C Language_PPS_3110003_unit 8ClassPPT.ppt
PPTX
User defined data types.pptx
PDF
Structure In C
PPTX
STRUCTURES IN C PROGRAMMING
PPT
Structures and Unions in C-Language with Examples.ppt
Unit 5 (1)
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
detail structure presentation of problem solving
unit 5.pdf structure pdf is here you can do this
Fundamentals of Structure in C Programming
Structure in C
1. structure
Structures
Data Structures and Algorithms_Updated.pptx
Structure in C language
Module 5-Structure and Union
Structure.pptx Structure.pptxStructure.pptxStructure.pptxStructure.pptxStruct...
Structures in c language
Structures in c language
Structure prespentation
C Language_PPS_3110003_unit 8ClassPPT.ppt
User defined data types.pptx
Structure In C
STRUCTURES IN C PROGRAMMING
Structures and Unions in C-Language with Examples.ppt
Ad

Recently uploaded (20)

PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
Construction Project Organization Group 2.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
Project quality management in manufacturing
PPT
Mechanical Engineering MATERIALS Selection
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Current and future trends in Computer Vision.pptx
PDF
Well-logging-methods_new................
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Sustainable Sites - Green Building Construction
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Construction Project Organization Group 2.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Geodesy 1.pptx...............................................
additive manufacturing of ss316l using mig welding
Internet of Things (IOT) - A guide to understanding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Project quality management in manufacturing
Mechanical Engineering MATERIALS Selection
OOP with Java - Java Introduction (Basics)
CH1 Production IntroductoryConcepts.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Current and future trends in Computer Vision.pptx
Well-logging-methods_new................
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Sustainable Sites - Green Building Construction

Structure for cpu

  • 1. STRUCTURE Prepared By: Jay R. Patel Enrollment no.:160410119071 Id. No.:16bemev137 Mechanical-2 Batch: C Guided By: Uma Dave
  • 2. Basic Of Structure  Structure is a collection of different types of variables under a single name.  Structure is used to represent logically related data.  It is same as records used in “PASCAL”.  The structure is a very powerful and important tool which fulfills requirements of complex problems.
  • 3.  A simple example of a structure is information about students, ** students can be represented by roll-no, name, branch, joining date etc. ** It may be possible that a variable in the structure is also can be structure. i.e. A variables in structure can be also devided into components. For example, one variable ‘joining date’ of student which consist the date, month and year which are also variables.
  • 4.  The general format to define a structure is given as: struct_tag { data_type member_variabe1; data_type member_variabe2; . . . } s1,s2,s3; Defining Of Structure & Members
  • 5. *** In previous slide ,  struct is a reserve word and used to define a structure.  struct_tag is an optional tag which provides type name to the structure.  The members of structures are enclosed in pair of {}.  Each member consist of a datatype and variable name followed by semicolon(;).  After making declaration variables of student type are created as follows: struct student s1,s2,s3;  The defination(declaration) is ended with semicolon(;).
  • 6.  Then cosider following example of a structure, defining a student record, struct student { int roll_no; char name[20]; int age; } s1,s2,s3;
  • 7.  Members of a structure can be accessed and used individually in a problem.  Following syntax is used to access the members of a structure.  structure_name is the name of a structure variable & member_name is the name of the member of structure. & structure member operator “.” (dot) connects member name to structure name. for example, s1.age Here, s1 is structure variable and age is member name which is type of student. And following statement assigns value 20 to s1.age s1.age = 20; Accessing Structure Members Structure_name.member_name
  • 8.  The Age of student s1 can be read from keyboard as scanf(“%d”,&s1.age);  Following examples shows the use of structure members in various statements: 1. s2.roll_no = 10; 2. (s2.roll_no)++; 3. printf(“%d”,s1.roll_no); 4. strcpy(s1.name,”akshat”); 5. printf(“%s”,s1.name);
  • 9.  A structure can be member of another structure. This is known as nesteding of structure or structure within structure.  Consider the student record includes birth date. It is define as follows: struct date { int d; int m; int y; }; struct student { int roll_no; char name[20]; struct date birth_date; };  student is a variable, then day of birth define as: s1.birth_date.d which represents one integer. Nested Structures
  • 10. •In previous slide the structure is also be written as : struct student { int roll_no; char name[20]; struct date { int d; int m; int y; } birth_date; };  In this defination, date is part of student and its variables can not be created independently.  However, it looks like natural nesting.  The tag name date can be define in this case without any loss.