محمد عويضة القيق
last month
محمدcountry asked

What is pointer itself? Is it a variable in itself or something else?

Abhay Jajodia
Expert
last month
Abhay Jajodia answered

Hi there! Great question, let’s clear it up for you.

A pointer is indeed a type of variable in C programming. But, unlike regular variables that store actual values, a pointer stores the address of a variable in memory.

Think of a pointer like a directional sign pointing to where something is stored, rather than what is stored there. When you create a pointer for an integer with int* pt;, you're essentially saying, "I want pt to hold the address of a memory location that contains an integer." This is why we use the symbol * in pointers—it denotes that the variable is meant to store a memory address.

So, yes, while a pointer is a kind of variable, it differentiates itself by holding addresses rather than values directly. Remember, the variable that pt points to will be manipulated by accessing the address stored in pt.

Hope this helps! Let me know if you have more questions or need further clarification.

C
This question was asked as part of the Learn C Programming course.