Is 'private' a C keyword?

前端 未结 3 1995
自闭症患者
自闭症患者 2021-01-04 01:06

Are \'private\' or \'public\' keywords in ANSI C (or any other C for that matter), or were they only added in C++ (and Java, C#, ...)?

3条回答
  •  忘掉有多难
    2021-01-04 01:44

    static isn't like private, given that you can't read a static variable even in the constructor of the class (the function which inits members of a struct in C language).

    You only can use static variables in the part of the code where they were defined (in a function, a struct, ...).

提交回复
热议问题