---
title: "Advantages of using pointers"
subject: "Computer Programming"
chapter: 9
key: "semester_1/computer_programming:pointer-advantages"
source: https://www.bctengineer.com/q/semester_1/computer_programming/pointer-advantages
site: BCT Engineering
---

# Advantages of using pointers

Computer Programming · Chapter 9: Pointers

- Asked in: 2074 Asoj, 2 marks; 2074 Chaitra, 3 marks; 2071 Shrawan, 2 marks; 2069 Asar, 2 marks (asked 4 times)
- Video: [C Programming #5 - Pointers Advantages & Disadvantages ||Pointers||C by Seenu || aaluri seenu](https://www.youtube.com/watch?v=4mQnsCYQCZQ) — Seenu & Sudha
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/pointer-advantages
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-9

## Question

Write down the advantages of using pointers in C programming.

## Short answer

Pointers allow call by reference, efficient array/string handling, dynamic memory allocation, construction of data structures, function pointers, direct memory access, and arrays of strings. They enable functions to modify caller variables and manage runtime memory.

## Answer

A **pointer** is a variable that stores the address of another variable. Its main advantages are:

1. **Call by reference**: functions can change the caller's variables (for example `swap(&a, &b)`) and can return more than one result.
2. **Efficient array and string handling**: elements are reached by pointer arithmetic, which is fast and compact, and large arrays or structures are passed by address without copying.
3. **Dynamic memory allocation**: memory can be taken and freed at run time with `malloc()`, `calloc()` and `free()`, so the program uses only the memory it needs.
4. **Data structures**: linked lists, stacks, queues, trees and graphs are built with pointers.
5. **Functions as arguments**: pointers to functions allow callbacks and menu tables.
6. **Direct memory access**: useful in system and hardware programming.
7. Arrays of pointers (such as an array of strings) save memory and make sorting easy, since only the pointers are exchanged.

## Check yourself

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

1. Why can swap(&a, &b) change the caller's variables?
   A. Because it passes copies of a and b
   B. Because it passes the addresses so the function works on the originals
   C. Because swap is a library function
   D. Because a and b are global
   Answer: B. Passing addresses lets the function reach the original variables through pointers (call by reference). (Key point: Call by reference)

2. Which advantage lets a program take and free memory at run time so it uses only what it needs?
   A. Pointer arithmetic
   B. Function pointers
   C. malloc(), calloc() and free() through pointers
   D. Call by value
   Answer: C. Dynamic allocation functions return pointers to memory obtained at run time. (Key point: Dynamic memory allocation)

3. Why does an array of pointers to strings make sorting easy?
   A. Only the pointers are exchanged, not the characters
   B. The characters are sorted automatically
   C. Strings are stored in fixed equal lengths
   D. It needs no comparison
   Answer: A. Swapping pointers is cheap compared with copying whole strings. (Key point: Array of pointers for strings)

## Related in Computer Programming

- [Array of pointers](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Aarray-of-pointers) — Computer Programming, chapter 9
- [Pointers in pass by reference; 2D array](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apointer-passing-by-reference-2d) — Computer Programming, chapter 9
- [Arithmetic operations on pointers](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apointer-arithmetic-operations) — Computer Programming, chapter 9
- [Swap two values using pointers](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Apointer-swap-function) — Computer Programming, chapter 9

## Related in other subjects

- [Limitations of procedural programming](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Aprocedural-limitations) — Object Oriented Programming, chapter 1
