![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
'*' is not "the address of". '&' is "the address of" (in one of its guises). '*' is the opposite (the thangy residing at the address).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 | |
|
Hobbyist Programmer
|
Quote:
var x = My House var *y = &x; print x; //prints My House print y; //prints 0x010000 print *y; //prints My House & is read as "the address of" * is read as "contents of the address" There are also "pointers to pointers" with **. But I won't go into that on the basis that I might screw up again. :o |
|
|
|
|
|
|
#13 | |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
Quote:
However, I had no idea you could do LL's and BST's without pointers. Is it only other languages that can do that, or C++ too? |
|
|
|
|
|
|
#14 | |
|
SEXY SHOELESS GOD OF WAR!
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,193
Rep Power: 5
![]() |
Quote:
As to how to do it, it's simple: instead of using actual pointers, you allocate an array, and then store indices into the array. Of course, you still have issues regarding the need to resize the array, but even some languages that don't directly support pointers have facilities to do this.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
|
|
#15 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#16 | |
|
Newbie
Join Date: Apr 2006
Location: Israel
Posts: 4
Rep Power: 0
![]() |
Quote:
couldn't agree more !
__________________
There will be blood... |
|
|
|
|
|
|
#17 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
I've read a couple of posts about how no one will pay you if you program without classes or pointer. That's a false statement and my paycheck proves it
![]() Let's remember, C is a great language with many applications in embedded and linux, yet it doesn't have classes. COBOL is good for business applications and data manipulation, yet it doesn't have pointers |
|
|
|
|
|
#18 |
|
Newbie
Join Date: May 2006
Posts: 1
Rep Power: 0
![]() |
pointers are so important and we can't do without them.
|
|
|
|
|
|
#19 | |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3
![]() |
Quote:
Alsom without pointers, you can't proceed into understanding polymorphism in C++. Although errors with pointers will give you the creeps at first, it is an essential part of C++ programming. And do not forget that the only reason that a thing like this exists, is to facilitate the work of programmmers, and not make it more difficult than it already is. So, as you understand, you will become more efficient if you use pointers and references. Finally, without pointers, you will really have no luck if you intend to proceed into learning Objective-C (not that you said that you intend to, but just saying... )Everyone sees it as a difficult part of C++ at first, and that is proved by the numbers of tutorials and threads on pointers on the internet. But don't let that intimidate you...
__________________
Project::Soulstorm (personal homepage) |
|
|
|
|
|
|
#20 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
There's a Pointer Basics link in my sig and Narue has a good one, too.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|