Programmer Coding

Identifier in C++?

The names of variables, functions, arrays, and other user-defined data types that the programmer has generated are referred to by C++ identifiers in programmes. They are a language’s fundamental requirements. There are certain guidelines for naming the IDs in each language.

There are several types of identifiers in C++:

Variable names: used to keep values in memory

Function names: used to specify operations and carry out tasks

Class names: used for object creation and class definition

Object names: examples of classes

Enumeration constants: in data types that are enumerated

Label names: employed in program to identify statements

Namespaces: used to arrange code and eliminate naming conflicts.
Keyword in C++

The reserved words that are predetermined and have a certain meaning are called keywords. Any program me statement can be defined with the use of keywords. In terms of C language, there are 32 keywords. Among the keywords are double, int, auto, char, break, and a few others.

Example:

#include<iostream>

using namespace std;

int main(){

   // Using Initilazation Const Keyword

   const int x = 20;

   cout<<"Value is: "<<x;

return 0;

}

Output is:

Value is: 20

Keyword vs identifier

 

S.No. Keyword Identifier
1 Reserved words with specialized definitions and distinct connotations are called keywords. Any program me statement can be defined with the use of keywords. An identifier is a specific name that a programmer creates to define a class, function, variable, or structure.
2 A lowercase letter starts a keyword. The initial character in the identification may start with underscores, lowercase letters, or capital letters.
3 It describes the kind of thing. It categories the entity’s name.
4 Only characters in the alphabet are allowed. It may contain underscores, digits, and characters from the alphabet.
5 It needs to be written in lowercase. It can have capital and lowercase letters.
6 It is useful for specifying a specific feature of a computer language. It is useful for finding the entity’s name.
7 Keywords include double, int, auto, char, break, and more. Examples of identifiers are test, count1, high-speed, etc.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top