A pointer points to a memory location containing a specified value right? If a pointer is defined without something to point at, it can point anywhere, right? Here is my question: What are the practical uses of pointers? I mean why wouldn't you just make a reference to the variable itself instead of having one more name to remember?
fireballnelson
0
Newbie Poster
Recommended Answers
Jump to Postint *x = new int();
How can you dynamically allocate memory on the heap using a reference?
Jump to PostHow can you dynamically allocate memory on the heap using a reference?
int &x = *new int();
This should do it.
Jump to PostA pointer points to a memory location containing a specified value right? If a pointer is defined without something to point at, it can point anywhere, right? Here is my question: What are the practical uses of pointers? I mean why wouldn't you just make a reference to the variable …
All 12 Replies
Comatose
290
Taboo Programmer
Team Colleague
dougy83
74
Posting Whiz in Training
Comatose
commented:
Nice Job
+8
Comatose
290
Taboo Programmer
Team Colleague
Murtan
317
Practically a Master Poster
ArkM
1,090
Postaholic
Murtan
317
Practically a Master Poster
ArkM
1,090
Postaholic
Murtan
317
Practically a Master Poster
Liinker
3
Newbie Poster
Murtan
commented:
I like it, short sweet and pretty clear
+2
ArkM
1,090
Postaholic
Murtan
317
Practically a Master Poster
ArkM
1,090
Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.