Ryuuji
22nd November 2012, 03:00
Hi everyone!
I'm encountering problem about typedef struct. The case was i declared a struct inside a class like this:
class Myclass
{
private:
typedef struct MysampleStruct{
int x;
int y;
}Mysample[3];
}
If I'm going to use this struct like this:
Mysample[0].x = 1;
I'm having an error like "expected unqualified-id '[' token".
But if I'm gonna delete the 'typedef' in 'typedef struct MysampleStruct', its working fine.
Can someone explain to me why these happen?
Thanks in advance.
I'm encountering problem about typedef struct. The case was i declared a struct inside a class like this:
class Myclass
{
private:
typedef struct MysampleStruct{
int x;
int y;
}Mysample[3];
}
If I'm going to use this struct like this:
Mysample[0].x = 1;
I'm having an error like "expected unqualified-id '[' token".
But if I'm gonna delete the 'typedef' in 'typedef struct MysampleStruct', its working fine.
Can someone explain to me why these happen?
Thanks in advance.