C++ Keywords and Identifiers2 min read

Keywords

A keywords are the reserved words in programming language with a specific features for each keyword. Keywords always starts with the lower case and cannot be a variable name or constant name. These are predefined by the program and their value cannot be changed.

Example: int, float, public, etc.

The following is the list of 30 keywords in C++ that are also available in C programming language.

autobreakcasecharconst
doubleelseenumexternfloat
intlongregisterreturnshort
structswitchtypedefunionunsigned
continuedefaultdoforgoto
ifsignedsizeofstaticvoid
volatilewhile

The following is the list of 30 keywords in C++ that are not available in C programming language.

asmdynamic_castnamespacereinterpret_castbool
explicitnewstatic_castfalsecatch
operatortemplatefriendprivateclass
thisinlinepublicthrowconst_cast
deletemutableprotectedtruetry
typeidtypenameusingvirtualwchar_t

Identifiers

Identifiers are nothing but the name assigned to the entities such as variables, functions, arrays, or other user-defined data types. Identifiers are the basics need of programming language.

The name assigned to the entities is unique so that it can be identified during the execution of the program. Identifiers cannot be used as Keywords.

Example: int number;, number being an identifier.

Rules for naming identifiers:

  • Identifiers are case-sensitive that is uppercase and lowercase letters are distinct.
  • The first letter of identifiers must be a letter or underscore. After the first letter, you can use digits.
  • White spaces are not allowed.
  • A keyword cannot be used as an identifier.

Some valid and invalid identifiers:


MORE

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …
Read More

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …
Read More

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …
Read More

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …
Read More

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …
Read More

Inverted Half Pyramid Pattern of Alphabets in C

In this tutorial, we will write a C program to print half Pyramid using alphabets/characters. Before that, you may go through the following topic in …
Read More