Pointers in C

📘 C 👁 50 views 📅 Dec 22, 2025
⏱ Estimated reading time: 1 min

A pointer is a variable that stores the address of another variable.


Declaration of Pointer

data_type *pointer_name;

Example:

int *p;

Initialization of Pointer

int a = 10; int *p = &a;

Accessing Value Using Pointer

  • & → Address of operator

  • * → Dereference operator

printf("%d", *p);

Example Program

#include int main() { int a = 10; int *p; p = &a; printf("Value of a = %d\n", a); printf("Address of a = %p\n", p); printf("Value using pointer = %d", *p); return 0; }

Pointer Arithmetic

  • p + 1 moves pointer to next memory location

  • Increments depend on data type size


Types of Pointers

  • Null Pointer

  • Void Pointer

  • Wild Pointer

  • Dangling Pointer


Pointer and Array Relationship

  • Array name acts as a pointer to first element

int a[5]; int *p = a;

Passing Pointer to Function

Used to modify original value (Call by Reference).

void swap(int *a, int *b);

Advantages of Pointers

  • Efficient memory usage

  • Supports dynamic memory allocation

  • Enables call by reference

  • Useful in arrays and strings


Precautions

  • Initialize pointers before use

  • Avoid accessing invalid memory

  • Use pointers carefully to prevent errors


Summary

  • Pointers store memory addresses

  • * and & are key pointer operators

  • Closely related to arrays and functions

  • Powerful but must be used carefully


🔒 Some advanced sections are available for Registered Members
Register Now

Share this Post


← Back to Tutorials

Popular Competitive Exam Quizzes

🤖 AI Quizer Assistant

📝 Quiz
📚 Categories
🏆 Leaderboard
📊 My Score
❓ Help
👋 Hi! I'm your AI quiz assistant for Quizer.in!

I can help you with:
• 📝 Finding quizzes
• 🏆 Checking leaderboard
• 📊 Your performance stats

Type 'help' to get started! 🚀
AI is thinking...