Professional Documents
Culture Documents
Programming II
Course Code: GEC 225
Omega Semester
2021/2022
Lead Lecturer: Prof. E. Adetiba
Lecturers: Mrs. Temitope Takpor,
Engr.(Mrs.) A.H. Ifijeh
Teaching Asst.: Omolola Ademola
Module 5
Structures and Unions in C
Language
5.1.0 Structures
A structure provides a way to store
multiple variables of similar or different
types under one name.
This makes program more modular as
different variables referring to different
values can be accessed through a single
structure object.
It is a collection of data items like array,
except that with a structure, the data
items can have different data types.
3 Friday, May 13, 2022
If you want to store the following information
about a person in a database:
ü Name
ü Citizenship number
ü Salary
You can easily create different variables:
üstrName
üstrCitNo
üintSalary
to store these information separately.
Action Point:
Run this code in your compiler and provide all required
inputs.
22 Friday, May 13, 2022
5.2.0 Union
Unions are conceptually similar to structures.