Friday 7 October 2011

Keywords


Keywords are predefined reserved identifiers that have special meanings.They cannot be used as identifiers in your program.
Here are some of the C++ keywords and their uses.

array          =  Array is not part of the type
break         =  Stops the execution of the scope in which it is located.
bool           =  It can give only two things True or False
case          =  This is used in switch statements to specify certain cases.
char           =  Used to declare character variable or array (string).
class          =  This is used when we are declaring classes.
const          =  For declaring const variable,a variable which cannot be changed.
continue     =  This is used when we want something to skip and move next.
delete         =   It is used to delete dynamic memory which we have used.
default        =   This is used in switch, and every condition has default condition.
do               =  This is used to perform multiple tasks under a condition.It is a loop keyword.
double         =   It is a type of variable and used to declare double variables.
else             =   It can be used when there is an if statement or multiple if statements.
false            =   It is used with bool keyword because bool returns only true or fasle.
finally          =  This is used in exception handling.
float             =  It is a type of variable used to declare float variables i.e. decimal numbers.
for               =  This is used to perform multiple tasks under a condition.It is a loop keyword.
if                  =  It is used to check certain conditions.      
inline           =  When you are defining function outside the class but want to make it inline.
int                =  It is a type of variable used to declare int variables i.e. whole numbers.        
long             =  It is a type of variable used to declare long variables.
namespace  = Identifies and assigns a unique name to a userdeclared namespace.
new             = It is used in the declaration of dynamic memory.
return          = This is used in functions
sizeof          = It is a built in function which tells the size of any variable or array.        
struct          = It is used in structure declaration which are user define data type.        
static          = It retains value unless any mathematical operation applied on the variable.
switch        = It is a bundle of cases to use one at a time otherwise default will run.
template    = It's declaration specifies a set of parameterized classes or functions.
true            = It is used with bool keyword because bool returns only true or fasle         
typename   = Tells the compiler that an unknown identifier is a type.
unsigned    = Unsigned types can only represent positive values (and zero)
union         = A union is a user-defined data or class type.            
virtual        =  The virtual keyword declares a virtual function or a virtual base class.
void           = It means nothing and it is used to mention return type or argument.
while         = This is used to perform multiple tasks under a condition.It is a loop keyword.

No comments:

Post a Comment