6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
Home Data Structure C C++ C# Java SQL HTML CSS JavaScript Ajax
https://www.javatpoint.com/data-structure-structure 1/6
6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
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.
Syntax
struct structure_name
{
data_type member1;
data_type member2;
.
.
data_type memeber;
};
Advantages
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.
Program
#include<stdio.h>
#include<conio.h>
void main( )
{
struct employee
{
int id ;
float salary ;
int mobile ;
};
https://www.javatpoint.com/data-structure-structure 2/6
6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
struct employee e1,e2,e3 ;
clrscr();
printf ("\nEnter ids, salary & mobile no. of 3 employee\n"
scanf ("%d %f %d", &e1.id, &e1.salary, &e1.mobile);
scanf ("%d%f %d", &e2.id, &e2.salary, &e2.mobile);
scanf ("%d %f %d", &e3.id, &e3.salary, &e3.mobile);
printf ("\n Entered Result ");
printf ("\n%d %f %d", e1.id, e1.salary, e1.mobile);
printf ("\n%d%f %d", e2.id, e2.salary, e2.mobile);
printf ("\n%d %f %d", e3.id, e3.salary, e3.mobile);
getch();
}
← Prev Next →
AD
For Videos Join Our Youtube Channel: Join Now
Feedback
Send your Feedback to feedback@javatpoint.com
https://www.javatpoint.com/data-structure-structure 3/6
6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
Help Others, Please Share
Learn Latest Tutorials
Splunk SPSS Swagger Transact-SQL
Tumblr ReactJS Regex Reinforcement
Learning
R Programming RxJS React Native Python Design
Patterns
Python Pillow Python Turtle Keras
Preparation
Aptitude Reasoning Verbal Ability Interview Questions
Company Questions
https://www.javatpoint.com/data-structure-structure 4/6
6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
Trending Technologies
Artificial AWS Selenium Cloud Computing
Intelligence
Hadoop ReactJS Data Science Angular 7
Blockchain Git Machine Learning DevOps
B.Tech / MCA
DBMS tutorial Data Structures DAA tutorial Operating
tutorial System
DBMS DAA
Data Structures Operating System
Computer Compiler Computer Discrete
Network tutorial Design tutorial Organization and Mathematics
Architecture Tutorial
Computer Network Compiler Design
Computer Discrete
Organization Mathematics
Ethical Hacking Computer Software html tutorial
Graphics Tutorial Engineering
Ethical Hacking Web Technology
Computer Graphics Software
Engineering
Cyber Security Automata C Language C++ tutorial
tutorial Tutorial tutorial
C++
Cyber Security Automata C Programming
https://www.javatpoint.com/data-structure-structure 5/6
6/7/24, 3:41 PM Structure (Data Structures) - javatpoint
Java tutorial .Net Python tutorial List of
Framework Programs
Java Python
tutorial
Programs
.Net
Control Data Mining Data
Systems tutorial Tutorial Warehouse
Tutorial
Control System Data Mining
Data Warehouse
AD
https://www.javatpoint.com/data-structure-structure 6/6