A pointer is a data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.
15
votes
12answers
2k views
int* i; or int *i; or int * i; [closed]
What is your favorite method to declare a pointer?
int* i;
or
int *i;
or
int * i;
or
int*i;
Please explain why.
see also: http://www.stroustrup.com/bs_faq2.html#whitespace
57
votes
33answers
5k views
What's a nice explanation for pointers?
In your own studies (on your own, or for a class) did you have an "ah ha" moment when you finally, really understood pointers? Do you have an explanation you use for beginner programmers that seems ...
30
votes
3answers
7k views
How is a Java reference different from a C pointer?
C has pointers and Java have what is called references. They have some things in common in the sense that they all point to something. I know that pointers in C store the addresses they point to. Do ...
17
votes
10answers
3k views
Why are pointers not recommended when coding with C++
I read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the ...
5
votes
8answers
2k views
What are use cases and advantages of pointers?
I often struggle to see the advantages of pointers (except for low level programming).
Why use of char* instead of a String or char[] or what advantages pointer arithmetic brings.
So what are the ...
3
votes
5answers
544 views
When and why would we use immutable pointers?
In Java, the String object is both immutable and also a pointer (aka reference type). I'm sure there are other types/objects which are both immutable and a pointer as well and that this extends ...