Jason wrote:
How do you access an int pointer inside a struct. This is how it seems like
it would work to me, but it doesn't...
struct maze {
int num;
int * roomnum;
};
void setmaze(struct maze * maze) {
maze->num = 1; //this is equivelant to: (*maze).num = 1
maze->(*roomnum) = 5;
}
As far as anyone can see, maze is the tag of a structure declaration. We
can see no structure object defined. 'struct maze *maze' is therefore
nonsense. How about this...
typedef struct maize {
int num;
int *roomnum;
} maize; /* Corny, right? */
Now maize is a user defined type for a structure. We can define a
structure of this type with something like this..
maize maze;
Now maze is a structure and maze.num is (int) and maze.roomnum is (int
*).
--
Joe Wright mailto:jo********@earthlink.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---