Search code examples
cprivate

Is 'private' a C keyword?


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#, ...)?


Solution

  • private is not a C89 or C99 keyword. See C Programming/Reference Tables on Wikibooks*.

    Also, C has nothing** to do with Java and C# (and, really, not C++ either). However, the converse is not true -- C++ grew from C, for example.

    * Better reference needed!
    ** Actually, C89 "borrowed" the const and volatile keywords from C++. Likewise, C99 "borrowed" the inline keyword, and also added _Bool and _Complex (like C++'s bool andcomplex, respectively) [citation-needed].