This wikipedia article will give you detailed information on what a pointer is:

In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address. Obtaining or requesting the value to which a pointer refers is called dereferencing the pointer. A pointer is a simple implementation of the general reference data type (although it is quite different from the facility referred to as a reference in C++). Pointers to data improve performance for repetitive operations such as traversing string and tree structures, and pointers to functions are used for binding methods in Object-oriented programming and run-time linking to dynamic link libraries (DLLs).

Answer from David Segonds on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › c language › c-pointers
Pointers in C - GeeksforGeeks
A pointer is a variable that stores the memory address of another variable. Instead of holding a direct value, it holds the address where the value is stored in memory. It is the backbone of low-level memory manipulation in C.
Published   November 14, 2025
Discussions

programming languages - What is a Pointer? - Stack Overflow
In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address. Obtaining or requesting the value to which a pointer refers is called dereferencing the pointer. More on stackoverflow.com
🌐 stackoverflow.com
What exactly is a C pointer if not a memory address? - Stack Overflow
Now I am slightly confused--what exactly is a pointer, then, if not a memory address? ... The author later says: ...I will continue to use the term 'address of' though, because to invent a different one [term] would be even worse. More on stackoverflow.com
🌐 stackoverflow.com
Why Use Pointers in C? - Stack Overflow
I'm still wondering why in C you can't simply set something to be another thing using plain variables. A variable itself is a pointer to data, is it not? So why make pointers point to the data in... More on stackoverflow.com
🌐 stackoverflow.com
How do pointer-to-pointers work in C? (and when might you use them?) - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... No not homework.... just wanted to know..coz i see it a lot when i read C code. ... A pointer to pointer is not a special case of something, so I don't understand what you don't understand about ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
W3Schools
w3schools.com › c › c_pointers.php
C Pointers
They are important in C, because they allow us to manipulate the data in the computer's memory. This can reduce the code and improve the performance. If you are familiar with data structures like lists, trees and graphs, you should know that pointers are especially useful for implementing those. And sometimes you even have to use pointers, for example when working with files and memory management. But be careful; pointers must be handled with care, since it is possible to damage data stored in other memory addresses.
🌐
Medium
medium.com › @Dev_Frank › pointers-in-c-422cccdbf2f6
POINTERS IN C. Pointer is a variable that stores the… | by Dev Frank | Medium
February 16, 2024 - It is like a guide that knows the exact location of some information in a computer’s memory. Rather than keeping the actual data, a pointer stores the precise location in the computer’s memory where the data is kept.
🌐
TutorialsPoint
tutorialspoint.com › home › cprogramming › c pointers overview
Understanding C Pointers
June 10, 2012 - C pointer is the derived data type that is used to store the address of another variable and can also be used to access and manipulate the variable's data stored at that location.
🌐
Wikipedia
en.wikipedia.org › wiki › Pointer_(computer_programming)
Pointer (computer programming) - Wikipedia
3 weeks ago - In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware.
Find elsewhere
🌐
Florida State University
cs.fsu.edu › ~myers › c++ › notes › pointers1.html
Pointer Basics
Although all pointers are addresses (and therefore represented similarly in data storage), we want the type of the pointer to indicate what is being pointed to. Therefore, C treats pointers to different types AS different types themselves.
🌐
Programiz
programiz.com › c-programming › c-pointers
C Pointers (With Examples)
And, the address of c is assigned to the pc pointer. To get the value of the thing pointed by the pointers, we use the * operator. For example: int* pc, c; c = 5; pc = &c; printf("%d", *pc); // Output: 5
Top answer
1 of 16
162

The C standard does not define what a pointer is internally and how it works internally. This is intentional so as not to limit the number of platforms, where C can be implemented as a compiled or interpreted language.

A pointer value can be some kind of ID or handle or a combination of several IDs (say hello to x86 segments and offsets) and not necessarily a real memory address. This ID could be anything, even a fixed-size text string. Non-address representations may be especially useful for a C interpreter.

2 of 16
64

I'm not sure about your source, but the type of language you're describing comes from the C standard:

6.5.3.2 Address and indirection operators
[...]
3. The unary & operator yields the address of its operand. [...]

So... yeah, pointers point to memory addresses. At least that's how the C standard suggests it to mean.

To say it a bit more clearly, a pointer is a variable holding the value of some address. The address of an object (which may be stored in a pointer) is returned with the unary & operator.

I can store the address "42 Wallaby Way, Sydney" in a variable (and that variable would be a "pointer" of sorts, but since that's not a memory address it's not something we'd properly call a "pointer"). Your computer has addresses for its buckets of memory. Pointers store the value of an address (i.e. a pointer stores the value "42 Wallaby Way, Sydney", which is an address).

Edit: I want to expand on Alexey Frunze's comment.

What exactly is a pointer? Let's look at the C standard:

6.2.5 Types
[...]
20. [...]
A pointer type may be derived from a function type or an object type, called the referenced type. A pointer type describes an object whose value provides a reference to an entity of the referenced type. A pointer type derived from the referenced type T is sometimes called ‘‘pointer to T’’. The construction of a pointer type from a referenced type is called ‘‘pointer type derivation’’. A pointer type is a complete object type.

Essentially, pointers store a value that provides a reference to some object or function. Kind of. Pointers are intended to store a value that provides a reference to some object or function, but that's not always the case:

6.3.2.3 Pointers
[...]
5. An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation.

The above quote says that we can turn an integer into a pointer. If we do that (that is, if we stuff an integer value into a pointer instead of a specific reference to an object or function), then the pointer "might not point to an entity of reference type" (i.e. it may not provide a reference to an object or function). It might provide us with something else. And this is one place where you might stick some kind of handle or ID in a pointer (i.e. the pointer isn't pointing to an object; it's storing a value that represents something, but that value may not be an address).

So yes, as Alexey Frunze says, it's possible a pointer isn't storing an address to an object or function. It's possible a pointer is instead storing some kind of "handle" or ID, and you can do this by assigning some arbitrary integer value to a pointer. What this handle or ID represents depends on the system/environment/context. So long as your system/implementation can make sense of the value, you're in good shape (but that depends on the specific value and the specific system/implemenation).

Normally, a pointer stores an address to an object or function. If it isn't storing an actual address (to an object or function), the result is implementation defined (meaning that exactly what happens and what the pointer now represents depends on your system and implementation, so it might be a handle or ID on a particular system, but using the same code/value on another system might crash your program).

That ended up being longer than I thought it would be...

Top answer
1 of 4
41

One common place where pointers are helpful is when you are writing functions. Functions take their arguments 'by value', which means that they get a copy of what is passed in and if a function assigns a new value to one of its arguments that will not affect the caller. This means that you couldn't write a "doubling" function like this:

void doubling(int x)
{
    x = x * 2;
}

This makes sense because otherwise what would the program do if you called doubling like this:

doubling(5);

Pointers provide a tool for solving this problem because they let you write functions that take the address of a variable, for example:

void doubling2(int *x)
{
    (*x) = (*x) * 2; 
}

The function above takes the address of an integer as its argument. The one line in the function body dereferences that address twice: on the left-hand side of the equal sign we are storing into that address and on the right-hand side we are getting the integer value from that address and then multiply it by 2. The end result is that the value found at that address is now doubled.

As an aside, when we want to call this new function we can't pass in a literal value (e.g. doubling2(5)) as it won't compile because we are not properly giving the function an address. One way to give it an address would look like this:

int a = 5;
doubling2(&a);

The end result of this would be that our variable a would contain 10.

2 of 4
20

A variable itself is a pointer to data

No, it is not. A variable represents an object, an lvalue. The concept of lvalue is fundamentally different from the concept of a pointer. You seem to be mixing the two.

In C it is not possible to "rebind" an lvalue to make it "point" to a different location in memory. The binding between lvalues and their memory locations is determined and fixed at compile time. It is not always 100% specific (e.g. absolute location of a local variable is not known at compile time), but it is sufficiently specific to make it non-user-adjustable at run time.

The whole idea of a pointer is that its value is generally determined at run time and can be made to point to different memory locations at run time.

Top answer
1 of 14
415

Let's assume an 8 bit computer with 8 bit addresses (and thus only 256 bytes of memory). This is part of that memory (the numbers at the top are the addresses):

  54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|    | 58 |    |    | 63 |    | 55 |    |    | h  | e  | l  | l  | o  | \0 |    |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+

What you can see here, is that at address 63 the string "hello" starts. So in this case, if this is the only occurrence of "hello" in memory then,

const char *c = "hello";

... defines c to be a pointer to the (read-only) string "hello", and thus contains the value 63. c must itself be stored somewhere: in the example above at location 58. Of course we can not only point to characters, but also to other pointers. E.g.:

const char **cp = &c;

Now cp points to c, that is, it contains the address of c (which is 58). We can go even further. Consider:

const char ***cpp = &cp;

Now cpp stores the address of cp. So it has value 55 (based on the example above), and you guessed it: it is itself stored at address 60.


As to why one uses pointers to pointers:

  • The name of an array usually yields the address of its first element. So if the array contains elements of type t, a reference to the array has type t *. Now consider an array of arrays of type t: naturally a reference to this 2D array will have type (t *)* = t **, and is hence a pointer to a pointer.
  • Even though an array of strings sounds one-dimensional, it is in fact two-dimensional, since strings are character arrays. Hence: char **.
  • A function f will need to accept an argument of type t ** if it is to alter a variable of type t *.
  • Many other reasons that are too numerous to list here.
2 of 14
55

How do pointers to pointers work in C?

First a pointer is a variable, like any other variable, but that holds the address of a variable.

A pointer to a pointer is a variable, like any other variable, but that holds the address of a variable. That variable just happens to be a pointer.

When would you use them?

You can use them when you need to return a pointer to some memory on the heap, but not using the return value.

Example:

int getValueOf5(int *p)
{
  *p = 5;
  return 1;//success
}

int get1024HeapMemory(int **p)
{
  *p = malloc(1024);
  if(*p == 0)
    return -1;//error
  else 
    return 0;//success
}

And you call it like this:

int x;
getValueOf5(&x);//I want to fill the int varaible, so I pass it's address in
//At this point x holds 5

int *p;    
get1024HeapMemory(&p);//I want to fill the int* variable, so I pass it's address in
//At this point p holds a memory address where 1024 bytes of memory is allocated on the heap

There are other uses too, like the main() argument of every C program has a pointer to a pointer for argv, where each element holds an array of chars that are the command line options. You must be careful though when you use pointers of pointers to point to 2 dimensional arrays, it's better to use a pointer to a 2 dimensional array instead.

Why it's dangerous?

void test()
{
  double **a;
  int i1 = sizeof(a[0]);//i1 == 4 == sizeof(double*)

  double matrix[ROWS][COLUMNS];
  int i2 = sizeof(matrix[0]);//i2 == 240 == COLUMNS * sizeof(double)
}

Here is an example of a pointer to a 2 dimensional array done properly:

int (*myPointerTo2DimArray)[ROWS][COLUMNS]

You can't use a pointer to a 2 dimensional array though if you want to support a variable number of elements for the ROWS and COLUMNS. But when you know before hand you would use a 2 dimensional array.

🌐
Cppreference
en.cppreference.com › w › c › language › pointer.html
Pointer declaration - cppreference.com
April 9, 2024 - The qualifiers that appear between * and the identifier (or other nested declarator) qualify the type of the pointer that is being declared: int n; const int * pc = &n; // pc is a non-const pointer to a const int // *pc = 2; // Error: n cannot be changed through pc without a cast pc = NULL; // OK: pc itself can be changed int * const cp = &n; // cp is a const pointer to a non-const int *cp = 2; // OK to change n through cp // cp = NULL; // Error: cp itself cannot be changed int * const * pcp = &cp; // non-const pointer to const pointer to non-const int
🌐
BYJUS
byjus.com › gate › pointers-in-c
Pointers in C
August 1, 2022 - The pointers perform the function of storing the addresses of other variables in the program. These variables could be of any type- char, int, function, array, or other pointers. The pointer sizes depend on their architecture.
🌐
Quicklearn3945
quicklearn3945.com › c-programming-pointer
C Programming Pointer - Quick Learn
December 1, 2024 - C Programming Pointer. In this chapter you will learn about C programming pointers; What are pointers, how to use pointers and common mistakes to face while working with pointers.
🌐
Codecademy
codecademy.com › docs › pointers
C | Pointers | Codecademy
August 7, 2024 - A pointer is a variable that stores a memory address, which typically represents the location of another variable. Pointers are useful because they allow the efficient creation and manipulation of complex data structures.
🌐
Medium
medium.com › nerd-for-tech › the-basics-of-pointers-in-c-1cb9b4ed3123
The Basics of Pointers in C. C Pointers are a type of variable used… | by Matthew Clark | Nerd For Tech | Medium
May 20, 2024 - With the use of pointers, we can directly manipulate a. This eliminates the need to add a return value because a will be changed directly. In summary, a pointer is a variable that holds the memory address of another variable.
🌐
Scaler
scaler.com › topics › c › pointer-declaration-in-c
Pointer Declaration in C - Scaler Topics
March 21, 2022 - The * symbol indicates that the variable is a pointer. To declare a variable as a pointer, you must prefix it with *. In the example above, we have done a pointer declaration and named ptr1 with the data type integer. ... 22 ways of initializing a pointer in C once the pointer declaration is done.
🌐
Scaler
scaler.com › home › topics › what is a pointer in c?
What is a Pointer in C | Scaler Topics
March 15, 2022 - A Pointer is a variable that holds the memory address of another variable. When we declare a variable of a specific data type we assign some of the memory for the variable where it can store it's data.
🌐
Substack
alexanderobregon.substack.com › p › using-const-and-volatile-in-c
Using const and volatile in C
1 week ago - A helper that walks an array without modifying it can take a const int * parameter, while a helper that treats a pointer as a cursor but must not lose the original address can take an int * const parameter. Choosing between those two forms depends on what the function is allowed to change and what must stay fixed while the call runs.