Hi
Below is the solution:
#include <iostream.h>
typedef struct {
int one;
int *two;
} *myT;
int main()
{
myT test = (myT)new myT;
int y = 20;
test->two = &y;
test->one = 9;
cout<<test->one;
return 0;
}
Regards
Sumant
--- On Sun, 14/3/10, nimak247 <[email protected]> wrote:
From: nimak247 <[email protected]>
Subject: [c-prog] How to access members of a typedef struct pointer??
To: [email protected]
Date: Sunday, 14 March, 2010, 2:13 AM
Hello all,
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->one = 9;
return 0;
}
I get an error that says "..left of '->two' must point to class/struct/
union/generic type". I thought by declaring the typedef as a struct that it
would be recognized as such??
I am trying to figure this out, but alas, no joy. Can anyone explain where I am
missing it??
Any help would be appreciated,
nim
Your Mail works best with the New Yahoo Optimized IE8. Get it NOW!
http://downloads.yahoo.com/in/internetexplorer/
[Non-text portions of this message have been removed]