Usage of “static” within a struct in C

后端 未结 6 1822
闹比i
闹比i 2020-12-18 18:53

Is it legal to have a \"static\" member within a C struct?

For example

struct my_struct {
    int x;
    static int y;
};

If indeed

6条回答
  •  不知归路
    2020-12-18 19:50

    you cannot use the static specifier in a structure...

    structure variables cannot be initialized inside a structure and static specifier initializes the variable to 0..

    this behavior is not allowed in C..

提交回复
热议问题