Topic 1 Part 2
Topic 1 Part 2
DATA STRUCTURES
DFC 30233
DATA STRUCTURES
TOPICS
Topic 1
Introduction to
data structures
Topic 6 Topic 2
Sorting &
List & Linked List
Searching
DFC 30233
Topic 5 Topic 3
Trees Stack
Topic 4
Queues
CONTENT
Data structure
Topic 1 Structures
Data structure
Topic 1 Structures
❑ Other examples:
int A[5];
int A[3] = {100, 1000, 10000};
struct product
{ Array of Structure
int weight;
float price;
} fruits[3];
maria
NESTED STRUCTURE
name title
charlie.name; year
favMovie
maria.favMovie.title;
charlie
charlie.favMovie.year;
name title
year
favMovie
maria
CONTENT
Data structure
Topic 1 Structures
Advantages Disadvantages
It is used to represent multiple data items of We must know in advance that how many
same type by using only single name elements are to be stored in array
struct Car
{
char platNum[10];
char owner[25];
int day, month, year;
};
struct Car C[100];
Write statement to display all the value for the struct variable C.
EXERCISE 3
3. Consider struct definition and declaration below:
struct Date
{
int day, month, year;
};
struct Date D[70];
Write statement to display all the value for the struct variable D.
CONTENT
Data structure
Topic 1 Structures