-
Pointer to a structure
How could I make a pointer to a structure?
The structure name is New_Room
I tried
New_Room *cur_room=test_room;
and a error saying "cannot convert type test_room from type New_Room to New_Room *"
so I tried
struct *cur_room=test_room;
another conversion thing came up.
int *cur_room=test_room;
parse error came up.
How in the bloody hell do you make a pointer to a structure? Can you even do this?
-
Pointers hold addresses.
New_Room *cur_room=&test_room;
-
if (cur_room.items[itemTMP]==I_FLOWER)
comes up with an error that says:
Request for member 'items' in 'cur_room' which is of Non-Aggregate type 'New Room *'
I tried it with the ampersand first, then I tried it like this.
What is wrong?
What the heck does Non-Aggregate mean anyway?
-
I dunno you probably need to post some code but if my crystal ball is working try -
if (cur_room->items[itemTMP]==I_FLOWER)
-
It is working correctly Mr. Know-it-all!
Say thank you, Rocky!
Thank you!
-
oh crud! I hit undo a few times and the code started screwing up. I am going to have a heck of a time sorting this crap out now!
Thanks again, sorensen. You have helped me a BUNCH of times. I just wish I could help you sometime to pay you back, but I am still learning, so that is probably a slim chance...
I am getting a C++ book and a C++ gaming book in a package, so I might stop asking easy questions. I forget which ones they are. They are both for windows, and they have source included. And when I get to be 14 (in July), I will get to work, and I'll try to save up for programming classes. But before I do the classes I should save up for MSVC++. I tried to D/L a pirated copy, but the file size was like 190 MB, and I get about 2k a second, at peek times (no kidding).