1

I am trying to construct an m-way tree and I am having trouble visualizing an array of pointers pointing to different instances of the B_tree node class (this basically creates the array type nodes and includes all functions associated with the tree such as count, insert etc)

Are there any tips/tricks to visualizing an array of pointers for this case? Are there any good links/resources for explanation of array of pointers? (I did not find the common search results on google that helpful)...

Paul
  • 19,704
  • 14
  • 78
  • 96
rrazd
  • 1,741
  • 2
  • 32
  • 47
  • also, put the tags as C++ and java, coders can help as well in your problem. – TheChes44 Jul 19 '11 at 18:37
  • @TheChes, I disagree. I have Java as one of my favorite tags because I want to help with Java coding. I don't want to get pulled into every CS question. I clicked on the question because I wondered "why is this question tagged with Java and C++"? This question would come up for someone searching on [java] and [tree], for example, and would not be a helpful result. I'm going to retag it. – Paul Jul 19 '11 at 19:41
  • true, well C++, thats where the pointers are anyways. I apologize Paul, didn't think about that. – TheChes44 Jul 19 '11 at 19:45
  • @Paul Good to know, hopefully I get more responses with the re tagging =S – rrazd Jul 19 '11 at 19:46

2 Answers2

7

Here is a picture of an array of pointers, they aren't pointing to anything, but this is a visualization of an array of pointers. Here is a link explaining arrays of pointers http://ee.hawaii.edu/~tep/EE160/Book/chap9/section2.1.4.html. Enjoy.enter image description here

TheChes44
  • 648
  • 1
  • 10
  • 21
0

Array with pointers is just like a usual array with a maximum number of size. Each position of the array it does not hold an integer or float or char or a struct. It holds a pointer. What a pointer is ? Imagine the computer's memory like a huge array which hold different kind of values. The variable which holds the pointer what it actually holds is the address of a block of memory. It does not hold the value of an integer but if you have int *a; , it means that the variable a which is store in a memory address hold the address of something which is integer.

The pointer always holds 4 bytes. Therefore an array with pointers means that each positions shows the memory address of something. If you have an integer array with pointers of size 10, means that each position shows the address of a memory block( this block stores an integer). So the array holds 10 pointers and each one of them shows to an integer.

thrylos
  • 1,513
  • 1
  • 10
  • 5