Thank you all for your speedy replies! The course I am taking has a section on pointers, so there are some exercises in their use. In the book, they mentioned using a pointer to a typedef'd struct as a way to refer to records as something that is done?
The class is a mixture of c and c++, so perhaps I wasn't supposed to tackle that one with c++, but I am trying to learn; to dig into the language a little. I saw they said you could do it, so I was seeing how it worked...But in the end I couldn't figure out how to do it :O( Sounds like I didn't need to know after all... nim --- In [email protected], Brett McCoy <idragos...@...> wrote: > > On Sat, Mar 13, 2010 at 4:07 PM, Paul Herring <pauljherr...@...> wrote: > > >> I am trying to create a type that is a pointer to a struct, but I cant seem > >> to access the contents of the struct. I am trying to do something like > >> this: > >> > >> typedef struct { > >> int one; > >> int *two; > >> } *myT; > >> > >> int main() > >> { > >> myT *test = new myT; > >> int y = 20; > >> test->two = &y; > >> > > > > *test->two = y; > > > > Why are you using pointers in C++? > > For that matter, using typedef'd structs is unnecessary in C++ also. > > -- Brett > ------------------------------------------------------------ > "In the rhythm of music a secret is hidden; > If I were to divulge it, it would overturn the world." > -- Jelaleddin Rumi >
