TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Pete Lyall 76703,4230 (X)
from: Jay Truesdale 72176,3565
date: 1990-12-15 19:41:52
subject: #8708-#Dynamic Structure Alloc

#: 8761 S3/Languages
    15-Dec-90  19:41:52
Sb: #8708-#Dynamic Structure Alloc
Fm: Jay Truesdale 72176,3565
To: Pete Lyall 76703,4230 (X)


Pete:

If I use "node_ptr->rp" then this 'is' a member of the pointed to structure,
this is probably why "node_ptr->rp->rp" failed, isn't any way to get to there
from here!

'rp' is a pointer to type b_tree_rec.  To get the 'next' item in my B-Tree I
need to use the indirection operator to get to where "node_ptr->rp" points to.

If I use *(node_ptr->rp) I get an error #102 bus trap error so I assume that
I'm referencing an area in the memory map that has nothing there.  I may try
using this as an argument to printf in hex format to try and figure out what's
going on.

If I use (*)(node_ptr->rp) I get a bunch of compile errors:

 "btree.c", line 169: ****  primary expected ****
     print_tree( (*)(node_ptr->rp) );
                   ^
 "btree.c", line 169: ****  expression missing ****
     print_tree( (*)(node_ptr->rp) );
                   ^
 "btree.c", line 169: ****  not a function ****
     print_tree( (*)(node_ptr->rp) );
                   ^ errors in compilation : 3


If I cast the pointer like this "(struct b_tree_rec *)(node_ptr->rp)" it both
compiles and works.


Guess I'll go do some more reading and experimenting and see if I can figure
this one out.  (Maybe I should have purchased that "Data Structures in C" book
I saw last week...)

-J



There are 2 Replies.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.