C++ Keywords Tutorial | C Programming All Keyword.

Ashutosh Kumar
By -
0
C++ Programming language Keywords Tutorial
Keywords in C++ Program 



Every programming language having set of reserved words which have predefined meaning to compiler. These words are known as keywords of that language. In C++ programming language also have a predefined set of words and always written in lowercase. 


As we know that C is subset of C++. Means C doesn't contains all of C++ features. C is extended to C++ by adding feature OOP paradigm. First, Lets see How may similar keywords is contained in C and C++. 

List of C Keywords:

char while do typedef auto
int if else switch ease
printf double struct break static
long enum register extern return
union const float short unsigned
continue for signed void default
goto sizeof volatile


Note* 
In c all keywords are in lower case although uppercase of same name can be used.

Keyword are reserved words where it has standard predefined meaning in C. But, They can be used as Identifiers in Uppercase format.  


In C++, these keywords are added in extra comparing to existing c language.



asm new delete
class template inline
this friend operator
private protected public
try catch namespace

yeah, these are extra keywords to compare to c language.

Even this keywords can categories in followings sets for better understanding (just for rough):



char, int, float, double 

Data Types used to store the character and numeric value in variable of these types. Respectively takes 1, 4, 4 and 8 bytes.

void

function doesn't return any void OR function does not takes any parameter.

signed, unsigned

make your primitive data types numeric value negative(-) and positive(+)

short, long

use it make int datatype to of 2 byte and 8 bytes

struct, union, typedef, enum

User define data types.

if, else, else if

Conditional execution.

for, while, do{...}while, continue, break

use in looping.

switch, case, break; default

for conditional branch.

const, auto, register, static

storage class for storing data.

sizeof

this operator is used for get size of datatypes in bytes.

volatile


template, class, this, private, protected, public 

Under OOP, these keyword are used to create Classes and it object.
Class is blue print of real world object. private, protected & public are specifier give a degree of visibility and accessibility (something like encapsulation).

friend

give ability to friend declared method access to use that class member variable from out side the class.

try, catch

use for exception handling.

new, delete

use for manual memory allocation.

inline

Option under C++ make a function inline or use normal function.



Updating ....

Post a Comment

0Comments

✍️ Only article/post centric comments are allowed.
❌**No Spam**
❌**Advertisement**
❌**No abuse**
Rules strictly applied ✅

Post a Comment (0)