Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is 'private' a C keyword?

Tags:

c

private

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

like image 260
ripper234 Avatar asked Mar 08 '09 07:03

ripper234


People also ask

What are the C keywords?

Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.

What does private do in C?

The class members declared as private can be accessed only by the functions inside the class. They are not allowed to be accessed directly by any object or function outside the class. Only the member functions or the friend functions are allowed to access the private data members of a class.

What is private public in C?

In C++, there are three access specifiers: public - members are accessible from outside the class. private - members cannot be accessed (or viewed) from outside the class. protected - members cannot be accessed from outside the class, however, they can be accessed in inherited classes.

Does C have private?

C does not have the notion of private .


1 Answers

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].

like image 97
strager Avatar answered Oct 20 '22 13:10

strager