---
title: "Define structure; need of structures"
subject: "Computer Programming"
chapter: 8
key: "semester_1/computer_programming:define-structure-need"
source: https://www.bctengineer.com/q/semester_1/computer_programming/define-structure-need
site: BCT Engineering
---

# Define structure; need of structures

Computer Programming · Chapter 8: Structures

- Asked in: 2067 Asoj, 2 marks; 2072 Kartik, 2 marks (asked 2 times)
- Video: [C_109 Structures in C - part 1| Introduction to Structures | C Programming](https://www.youtube.com/watch?v=LpHnHRI6gLc) — Jenny's Lectures CS IT
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/define-structure-need
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-8

## Question

Define the structures in C programming. Explain the need of structures.

## Short answer

A structure is a user-defined data type that groups logically related variables of possibly different types under a single name. It is needed because arrays cannot hold mixed-type records; it keeps entity data together, enables whole-record assignment/parameter passing, supports arrays of records for databases, and forms the basis of linked lists, stacks, etc.

## Answer

#### Definition
A **structure** is a user-defined data type in C which groups logically related variables, possibly of different data types, under a single name. Each variable inside is a **member**.

```c
struct student {
    char name[30];
    int roll;
    float marks;
};
struct student s1;     /* variable */
```

#### Need of structures
1. Arrays store only same-type data; a record (name, roll, marks) needs different types together.
2. All data about one entity is kept together, so the program is easier to read and maintain.
3. A whole record can be passed to or returned from a function, or assigned to another variable, in one step.
4. An array of structures stores many records (e.g. 100 students), the basis of file records and databases.
5. Structures are the building blocks of linked lists, stacks, queues and trees (with pointers).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. A structure in C is best defined as?
   A. A collection of same-type variables only
   B. A built-in numeric type
   C. A function that returns many values
   D. A user-defined type grouping related variables of possibly different types under one name
   Answer: D. Each variable inside is called a member. (Key point: Definition)

2. Which is a reason for needing structures?
   A. A whole record can be passed to or returned from a function in one step
   B. They remove the need for functions
   C. They can store only one value
   D. They make arrays unnecessary for all data
   Answer: A. Structures allow record-level assignment, passing and returning. (Key point: Need)

3. Structures with pointers are the building blocks of which?
   A. Only the printf function
   B. Linked lists, stacks, queues and trees
   C. Preprocessor macros
   D. Comments
   Answer: B. Dynamic data structures rely on structures with pointers. (Key point: Applications)

## Related in Computer Programming

- [Nested structures with example](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Anested-structure-explain) — Computer Programming, chapter 8, asked 7×
- [Use of typedef with structures](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Atypedef-in-structures) — Computer Programming, chapter 8
- [Arrays within structures](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aarrays-within-structures) — Computer Programming, chapter 8
- [Sort employee structures by salary](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Astruct-employee-sort-salary) — Computer Programming, chapter 8, asked 2×
- [Need of control statements](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Awhy-control-statements) — Computer Programming, chapter 5, asked 2×
- [Need of analysis and design](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aanalysis-design-before-coding) — Computer Programming, chapter 2

## Related in other subjects

- [Project financing; structures; capital structure steps](https://www.bctengineer.com/question.md?key=semester_7%2Fproject_engineering%3Aproject-finance-define-structures-steps) — Project Engineering, chapter 6
- [Drop structures: need and types with sketches](https://www.bctengineer.com/question.md?key=semester_6%2Firrigation_and_drainage_engineering%3Adrop-structures-types-sketch) — Irrigation and Drainage Engineering, chapter 7, asked 6×
- [Uses and scope of masonry structures](https://www.bctengineer.com/question.md?key=semester_5%2Fconcrete_technology_and_masonry_structure%3Amasonry-uses-scope) — Concrete Technology and Masonry Structure, chapter 7, asked 5×
- [Hill road drainage structures](https://www.bctengineer.com/question.md?key=semester_6%2Ftransportation_engineering_i%3Ahill-drainage-structures) — Transportation Engineering I, chapter 5, asked 4×
