Top "Pointers" questions

Data type that "points to" another value stored in memory.

Pointer arithmetic for void pointer in C

When a pointer to a particular type (say int, char, float, ..) is incremented, its value is increased by the size …

c pointers void-pointers pointer-arithmetic
Are there benefits of passing by pointer over passing by reference in C++?

What are the benefits of passing by pointer over passing by reference in C++? Lately, I have seen a number …

c++ pointers parameter-passing pass-by-reference
Returning pointer from a function

I am trying to return pointer from a function. But I am getting segmentation fault. Someone please tell what is …

c pointers segmentation-fault
Is the sizeof(some pointer) always equal to four?

For example: sizeof(char*) returns 4. As does int*, long long*, everything that I've tried. Are there any exceptions to this?

c++ c pointers memory sizeof
Pointers, smart pointers or shared pointers?

I am programming with normal pointers, but I have heard about libraries like Boost that implement smart pointers. I have …

c++ pointers
C++ Array of pointers: delete or delete []?

Cosider the following code: class Foo { Monster* monsters[6]; Foo() { for (int i = 0; i < 6; i++) { monsters[i] = new Monster(); } } virtual ~…

c++ arrays pointers delete-operator
Meaning of "referencing" and "dereferencing" in C

I read different things on the Internet and got confused, because every website says different things. I read about * referencing …

c pointers reference dereference
Pointer vs. Reference

What would be better practice when giving a function the original variable to work with: unsigned long x = 4; void func1(…

c++ variables pointers reference
Returning a pointer to a vector element in c++

I have a vector of myObjects in global scope. I have a method which uses a std::vector<myObject&…

c++ pointers containers iterator
With arrays, why is it the case that a[5] == 5[a]?

As Joel points out in Stack Overflow podcast #34, in C Programming Language (aka: K & R), there is mention of …

c arrays pointers pointer-arithmetic