BCA / B.Tech 11 min read

Pointers in C

Quick Summary & Key Takeaways

  • • Subject Focus: C Language Notes in English (BCA / B.Tech Syllabus)
  • • Core Topic: Pointers in C - General Topics
  • • Overview: Pointers in the C Language: In the C language, a pointer is an important and powerful feature that allows us to directly access memory locations. A poi...
  • • Key Concepts: C pointer, Address dereference arrays functions Hindi, Void pointers pointer,C pointer, Address dereference arrays functions, Void pointers pointer

Pointers in the C Language:


In the C language, a pointer is an important and powerful feature that allows us to directly access memory locations. A pointer is a variable that stores the memory address of another variable. By using pointers correctly, we can achieve maximum functionality in memory and solve complex programming problems.

What is a Pointer?
In C, a pointer is a variable that stores the memory address of another variable. It is used to directly access memory, pass arguments to functions, and in dynamic memory allocation.

Features of Pointers:
  • Stores Memory Address: A pointer stores the memory address of a variable.
  • Direct Memory Access: We can directly access memory through pointers.
  • Dynamic Memory Allocation: Pointers are used to allocate and deallocate memory at run-time.
  • Call by Reference: Pointers are used to pass arguments to functions, allowing us to change the original variable.

Declaration and Use of Pointers:
A pointer is declared using the `*` (star) symbol. The general form of declaration is `datatype *pointer_name;`. The provided example demonstrates how to declare a pointer, assign it the address of another variable using the `&` operator, and access the value at that address using the `*` (dereferencing) operator.

Pointer Operations:
  • Address-of Operator (&): This operator gets the memory address of a variable.
  • Dereferencing Operator (*): This operator accesses the data present at the address stored in the pointer.

Use of Pointers in Dynamic Memory Allocation:
Pointers are used for dynamic memory allocation, where functions like `malloc()`, `calloc()`, and `free()` are used. The example shows how to allocate memory with `malloc()`, assign a value, and then free the memory.

Types of Pointers:
  • NULL Pointer: Represents a pointer that is not assigned any value or address.
  • Wild Pointer: A pointer that has not been initialized with a memory address. It is dangerous and can crash the program.
  • Dangling Pointer: A pointer that points to a memory location that has been freed.
  • Function Pointer: A pointer that stores the address of a function and is used to invoke the function.

Importance and Uses of Pointers:
Call by reference with functions, dynamic memory allocation, use in data structures like linked lists, graphs, and trees, and returning multiple values from a function.

Advantages and Disadvantages of Pointers:
Advantages: Control over memory, speed and efficiency, and handling complex data structures.
Disadvantages: Lack of security, difficulty in debugging, and dangling pointer problems.

Frequently Asked Questions (FAQs)

Pointers in the C Language: In the C language, a pointer is an important and powerful feature that allows us to directly access memory locations.
Understanding Pointers in C is fundamental to mastering C Language Notes in English. It covers crucial concepts, solved problems, and revision points essential for academic and entrance exam success.
You can read free solved examples, detailed explanations, and key formulas for Pointers in C directly on the NotesMedia website or by downloading the NotesMedia App.