ELEVATE SKILLS!
ELEVATE SKILLS!

BLOG DETAILS

Read the complete blog details covering in-depth explanations, practical insights, and examples. Designed for computer science learners and technology enthusiasts who want clarity, guidance, and knowledge in simple, structured form.

Know More about Pointers in C Language

Definition :

The pointer is a special type of variable that is used to hold or store memory location (address) rather than value. Pointer can have any name that is legal for other variables and it is declared in the same fashion as other variables but is always denoted by an asterisk (*) operator.

Features of Pointer :

  1. It is a powerful feature of ‘C language’.
  2. Execution time with pointer is faster because data is manipulated with the address, i.e. direct access to memory location.
  3. Pointers are used for file handling.
  4. Pointers are used to allocate memory dynamically.
  5. It stores the address, not values.
  6. Pointer allows carry whole array to the function.
  7. Pointers will help in returning more than one value from the function.
  8. It allows indirect access of data.

Pointer Declaration:

The declaration of the pointer variable is similar to a normal variable declaration but preceding with an asterisk (*) symbol.

Syntax :

Data_Type *Variable_Name;

Example :

int *ptr;

Here type of variable ptr is ‘pointer to int’ or (int *), or we can say that the base type of ptr is int.

Initialization of Pointer Variable :

Global and local static pointers are automatically initialized to NULL but when we declare an automatic pointer variable it contains garbage value i.e. it may be pointing anywhere in the memory. So, we should always assign an address before using it in the program.

Example:
  int *ptr;
  int num=26;
  ptr=#
Pointer variable of any type always occupy 2 bytes (in 16-bit compiler) and 4 bytes (in 32-bit compiler) in memory because pointer variable is used for storing address, not value.

Thank You for Reading!

Thank you so much for taking the time to read my Computer MCQs Section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.

Don’t forget to subscribe and stay connected for future updates.