2012/02/04

[vc]warning C4091

小弟在.h裡宣告了一個struct,寫法如下:

typedef struct _student
{
        int chinese;
        int english;
        int math;
        int total;
};

編譯時出現C4091的警告-->ignored on left of 'struct ' when no variable is declared
正確寫法:
typedef struct _student
{
        int chinese;
        int english;
        int math;
        int total;
}_Student_Score;

宣告時:
_Student_Score John,Mary;

或者是另一種寫法:
struct _student
{
        int chinese;
        int english;
        int math;
        int total;
};

宣告時:
_student John,Mary;

以上!

沒有留言:

張貼留言