开发者

difference between enumerated and structure in c language? [closed]

开发者 https://www.devze.com 2023-01-18 19:04 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be r开发者_JS百科eopened, visit the help center. Closed 12 years ago.

difference between enumerated and structure.


Well, there's a big difference.

Enumerations do not have members or attributes.

Structures do not define lists of constants. A structure can contain enumerations, but an enumeration cannot contain structures.

A structure:

struct Test {
    int a;
    float b;
    char c;
};

An enumeration (enum):

enum fruits {
    APPLE,
    ORANGE = 3,
    PEAR
};

Is this an interview question?

0

精彩评论

暂无评论...
验证码 换一张
取 消