Not exactly what you're asking, but addressing an incorrect assumption: To deal with arrays use std::vector, or in the case of a fixed size array, std::array. They can returned by functions. Answer from alfps on reddit.com
๐ŸŒ
Ques10
ques10.com โ€บ p โ€บ 68382 โ€บ what-is-pointer-explain-its-advantages-and-disad-1
What is Pointer? Explain its advantages and disadvantages of it
Pointer :- A pointer is a variable that stores the address of another variable. Unlike other variables that helds values of a certain type, pointer holds the address of a variables .
๐ŸŒ
Blogger
programmertutor16.blogspot.com โ€บ 2013 โ€บ 10 โ€บ advantages-and-disadvantages-of.html
Advantages and disadvantages of pointers in c - PROGRAMMER TUTORIAL
Benefits(use) of pointers in c: Pointers provide direct access to memory Pointers provide a way to return more than one value to the functio...
๐ŸŒ
UK Academe
ukacademe.com โ€บ QuestionsBank โ€บ CProgramming โ€บ Pointer_And_There_Advantage
Pointer And There Advantage | C Programming | Questions Bank | UK Academe
Using pointer arrays to store character strings, saves data storage space in memory. Pointers allow C to support dynamic memory management. Pointers reduce length and complexity of programs.
๐ŸŒ
Blogger
see-programming.blogspot.com โ€บ 2013 โ€บ 10 โ€บ advantages-and-disadvantages-of.html
Computer Programming And Technology For Dummies: Advantages and disadvantages of pointers in c
The text provides a clear overview of pointers in C, highlighting both their advantages and disadvantages. Pointers offer powerful capabilities like direct memory access, dynamic memory management, and efficient data handling, which are essential for building complex data structures.
๐ŸŒ
Reddit
reddit.com โ€บ r/cpp_questions โ€บ what advantages/disadvantages do pointers/references have?
r/cpp_questions on Reddit: What advantages/disadvantages do pointers/references have?
April 30, 2019 -

I see a lot of people using pointers/references instead of a actual variable. I know that pointers are variables that store the memory location of a already existing variable and that references are not stored in memory because they "reference" to a variable (and because of that, it can't change to what it references on later).

I can think only 2 cases where pointers/references are useful:

  • Because I can't return an array, when I want to return one, I can return a reference to it.

  • To avoid variable-duplication.

Apart from this, I can't think why should I want to use them.

Did I understand something wrong?

Top answer
1 of 11
14

One benefit of pointers is when you use them in function arguments, you don't need to copy large chunks of memory around, and you can also change the state by dereferencing the pointer.

For example, you may have a huge struct MyStruct, and you have a function a().

void a (struct MyStruct* b) {
   // You didn't copy the whole `b` around, just passed a pointer.
}
2 of 11
8

Coming from Java, you'll have a slightly different perspective than what is presented in K&R (K&R doesn't assume that the reader knows any other modern programming language).

A pointer in C is like a slightly more capable version of a reference in Java. You can see this similarity through the Java exception named NullPointerException. One important aspect of pointers in C is that you can change what they point to by increment and decrement.

In C, you can store a bunch of things in memory in an array, and you know that they are sitting side by side each other in memory. If you have a pointer to one of them, you can make that pointer point to the "next" one by incrementing it. For example:

int a[5];

int *p = a; // make p point to a[0]
for (int i = 0; i < 5; i++) {
    printf("element %d is %d\n", i, *p);
    p++; // make `p` point to the next element
}

The above code uses the pointer p to point to each successive element in the array a in sequence, and prints them out.

(Note: The above code is an expository example only, and you wouldn't usually write a simple loop that way. It would be easier to access the elements of the array as a[i], and not use a pointer there.)

๐ŸŒ
UKEssays
ukessays.com โ€บ home โ€บ advantages and disadvantages of using a pointer computer science essay
Advantages And Disadvantages Of Using A Pointer Computer Science Essay | UKEssays.com
When setting up data ststructures ... the pointer to be manipulated as a memory address.Because pointers allow largely unprotected access to memory addresses....
Find elsewhere
๐ŸŒ
Tutorialtpoint
tutorialtpoint.net โ€บ 2021 โ€บ 06 โ€บ advantages-and-disadvantages-of-pointers-in-c.html
Advantages and disadvantages of pointers in C ~ TUTORIALTPOINT- Java Tutorial, C Tutorial, DBMS Tutorial
Advantages of pointers: Pointers are more efficient in handling arrays and data tables. Pointers permit references to functions and there by facilitating passing of function as arguments to other functions.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c++ โ€บ features-and-use-of-pointers-in-c-c
Features and Use of Pointers in C/C++ - GeeksforGeeks
July 28, 2025 - Pointers are used with data structures. They are useful for representing two-dimensional and multi-dimensional arrays. An array, of any type, can be accessed with the help of pointers, without considering its subscript range.
๐ŸŒ
Dotnet Tutorial
dotnetustad.com โ€บ c-programming โ€บ pointer-advantages-and-disadvantages
Pointer Advantages and Disadvantages
While pointers are powerful and essential in C and C++ programming, they should be used with caution, following best practices, and thorough testing to minimize associated risks
๐ŸŒ
O'Reilly
oreilly.com โ€บ library โ€บ view โ€บ object-oriented-programming โ€บ 9789332503663 โ€บ xhtml โ€บ head-0593.xhtml
12.13 - Advantages and Disadvantages of Pointers - Object Oriented Programming with C++, Second Edition [Book]
May 15, 2012 - Please note the following points. Dangling pointers, mostly, create difficult to diagnose errors. Pointers lead to memory leaks. For parameter passing with reference, in C language using pointers were compulsory.
Authors ย  Mahesh BhaveSunil Patekar
Published ย  2012
Pages ย  679
๐ŸŒ
Quora
quora.com โ€บ What-are-the-advantages-and-disadvantages-of-using-pointers-in-C-programming-language
What are the advantages and disadvantages of using pointers in C programming language? - Quora
Without pointers, it would be extremely cumbersome to deal with character strings. Without pointers, you could not use a great many standard library functions, as they return pointers and/or take them as argument...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ pointers-in-c-programming
How to Use Pointers in C Programming
May 3, 2023 - One of the most powerful uses of pointers in C is for dynamic memory allocation. This allows us to allocate memory at runtime, rather than at compile time. We use the malloc function to dynamically allocate memory, and it returns a pointer to ...
๐ŸŒ
Filo
askfilo.com โ€บ cbse โ€บ smart solutions โ€บ what are the advantages and disadvantages of using pointers? d
What are the advantages and disadvantages of using pointers? Differentia..
December 19, 2025 - For example, if an int pointer points to an int at address 1000, incrementing it will make it point to address 1004 (assuming 4 bytes for int). ... Pointer arithmetic is useful for traversing arrays and dynamic memory. ... These categories help ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ c-pointers
Pointers in C - GeeksforGeeks
Pointers are used to form complex data structures such as linked lists, graphs, trees, etc. Pointers reduce the length of the program and its execution time as well. Pointers are vulnerable to errors and have following disadvantages:
Published ย  November 14, 2025
๐ŸŒ
Quora
quora.com โ€บ What-are-the-advantages-of-a-pointer-in-the-C-programming-language
What are the advantages of a pointer in the C programming language? - Quora
Answer (1 of 7): 1.To allocate memory dynamically. 2.To pass array or string more efficiency. 3.To return more than one value from function. 4.To built complex data structure.
Top answer
1 of 8
6

Pointers are necessary for dynamic memory location, many data structures, and efficient handling of large amounts of data. Without pointers, you'd have to allocate all the program data globally or in functions or the equivalent, and you'd have no recourse if the amount of data grew beyond what you had originally allowed for. I hesitate to use absolutes here, but as far as I know all modern computer languages have pointers in some form or other.

In most languages that use pointers, there are certain sorts of references that are pointers, and perhaps certain sorts of references that aren't, and there is no further notational difference. A Lisp cons cell is a pair of pointers, although a fixnum is not a pointer. In Java, the variable used for the instance of a class is a pointer, but an int isn't. The language syntax doesn't reflect that.

C is unusual in that pointers are optional, explicit, and allow explicit pointer arithmetic. It is perfectly possible to write struct foo bar; struct foo * baz;, and once you've allocated memory for baz you can use both bar and baz to represent struct foos. Since pointers are optional, it is useful to have notational differences. (It's essential in C++ for smart pointers, as given boost::shared_ptr<foo> bar;, bar.reset() has one meaning and bar->reset() is likely to have a much different one.)

(Actually, explicit pointers were often used in other languages when C was originally being developed, such as ^ in Pascal. C is an older language than most in common use today, and it shows.)

One of C's design goals was to write Unix in, and therefore it needed to handle memory locations in a detailed manner. (C is actually one of a family of system implementation languages common when it was being designed, another example being Cybol for Control Data computers. C is the one that became a big hit.) Therefore, it is possible to manipulate C pointers directly, assigning memory addresses and calculating new ones. This also led to some design decisions in C. C arrays are based heavily on pointer arithmetic, and indeed an array decays into a pointer in very many situations. Passing variables to C functions by reference is done by pointer. There was no strong need for arrays and passing variables by reference in the form that other contemporary languages had, so C didn't get those.

So, the answer is that, in most languages nowadays, you use pointers constantly without being reminded of the fact. In C, and to a lesser extent C++, you use pointers either to do low-level things, or as accomplish higher-level things that there's no special notation for.

2 of 8
10

Complex data structures. You can't build something like a linked list or a binary tree without pointers.

There are no "pros" and "cons" of pointers. They are just a tool, like a hammer.