---
title: "Significance of user defined functions"
subject: "Computer Programming"
chapter: 6
key: "semester_1/computer_programming:significance-user-defined-functions"
source: https://www.bctengineer.com/q/semester_1/computer_programming/significance-user-defined-functions
site: BCT Engineering
---

# Significance of user defined functions

Computer Programming · Chapter 6: User-Defined Functions

- Asked in: 2073 Chaitra, 5 marks
- Video: [C Programming Tutorial   33 User Defined Function](https://www.youtube.com/watch?v=IRcUKuYvg5A) — Telusko
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/significance-user-defined-functions
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-6

## Question

Explain the significance of user defined functions with example.

## Short answer

User-defined functions break a large program into smaller, reusable parts, improving readability, maintainability, and team collaboration. For instance, area_circle and area_rect compute areas and can be called multiple times with different arguments, avoiding code duplication.

## Answer

A **user-defined function** is a function written by the programmer to do a particular job, apart from the library functions. Its significance:

- **Divide and conquer:** a large problem is split into smaller functions, each easy to code and test.
- **Code reuse:** the same function is called whenever needed instead of copying the code.
- **Easier debugging and updating:** a change is made in one place only.
- **Better readability:** meaningful names show what each part does.
- **Hides detail:** the caller needs to know only what the function does, not how.
- **Team development:** different people can write different functions.

Example:
```c
#include <stdio.h>
float area_circle(float r) { return 3.1416f * r * r; }
float area_rect(float l, float b) { return l * b; }
int main(void)
{
    printf("Circle: %.2f\n", area_circle(3));
    printf("Rectangle: %.2f\n", area_rect(4, 5));
    printf("Circle: %.2f\n", area_circle(1.5f));   /* reuse */
    return 0;
}
```
Output:
```text
Circle: 28.27
Rectangle: 20.00
Circle: 7.07
```

`area_circle()` is written once and is used twice with different data.

## Check yourself

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

1. Divide and conquer?
   A. One large
   B. Remove
   C. Macros
   D. Split into smaller functions
   Answer: D. Meaning. (Key point: Divide)

2. Hides detail means?
   A. Caller needs only what, not how
   B. Hide variables
   C. Encrypt
   D. Skip
   Answer: A. Abstraction. (Key point: Hide)

3. area_circle reused?
   A. Copied
   B. Written once, used with different data
   C. Recompiled
   D. Global
   Answer: B. Reuse. (Key point: Reuse)

## Related in Computer Programming

- [Switch versus user defined function](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aswitch-vs-user-function) — Computer Programming, chapter 5
- [Significance of arrays; multiply 3×3 matrices](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aarray-significance-multiply-matrices) — Computer Programming, chapter 7
- [Advantages of using functions](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aadvantages-of-functions) — Computer Programming, chapter 6
- [Merits of functions; actual vs formal parameters](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Audf-merits-demerits-parameters) — Computer Programming, chapter 6
- [Reverse a string using functions](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Astring-reverse-with-count-function) — Computer Programming, chapter 7, asked 2×
- [Series (2*3/5)+(4*5/7)+… with functions](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aseries-2x3-over-5-recursive) — Computer Programming, chapter 6

## Related in other subjects

- [Convert user-defined type to basic type](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Auser-to-basic-conversion) — Object Oriented Programming, chapter 5
- [Impulse response and transfer function significance](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aimpulse-response-transfer-significance) — Communication Systems, chapter 1
- [Functions of paint](https://www.bctengineer.com/question.md?key=semester_3%2Fcivil_engineering_materials%3Afunctions-of-paint) — Civil Engineering Materials, chapter 9, asked 3×
- [Spectrum management and regulatory functions](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Aspectrum-management-regulatory) — Wireless Communication, chapter 1, asked 2×
