Powered by Blogger.
  • Home
  • C++ Tutorials
  • Cpp Programs
  • Privacy Policy
  • About
  • Contact
facebook instagram Email

Programming Vital - Learn to Code for Free

Identifiers in C++

Identifier

C++ identifiers are names used to identify variable, function, class or any other user-defined items. For Example Variable name, Function name, Class name, structure name.

An identifier starts with a letter either capitals (A to Z) or small (a to z) or an underscore _ that does not begin with a digit. C++ does not allow us to use punctuation characters such as -, @, $ and % within identifiers. C++ is a case sensitive programming language. Thus, Demo and demo are two different identifiers.

Valid Identifiers: Foo, _demo, abc, move_name, a_123, myname50, _temp, a23b9, retVal

Invalid Identifiers: 1Demo, a-123, demo@dss, Amount$100, a%b

Rules for naming an identifier

  1. Identifier name must begin with a letter, either capital (A to Z) or small (a to z).
  2. Identifier name does not begin with a digit (0-9).
  3. It must not contain any space or tab.
  4. Keywords cannot be used as an identifier.
  5. Special Symbols are not allowed in identifier names.
  6. Length of an identifier is at most 32 characters.
  7. Identifiers are case sensitive.

Let’s discuss some examples

Name
Use
Explanation
1sal
No
Because identifier does not begin with a digit.
first name
No
Because there should be no space or tab.
age@
No
Because it does not contain special letters.
While
Yes
Because While is not a keyword. (W is capital and small w is for keyword).
_rent
Yes
Begins with an underscore.
for
No
Because it is a keyword.
last_name
Yes
Because it contains letters and underscore and there is no space between them.


Conventions for naming identifiers

Following conventions is a good practice because it increases the readability of code. It makes the code easier to understand and thus help many people understand the code.

  • Use only letters either capital or small.
  • Use camelCase style for naming an identifier.
  • Choose a name which genuinely shows its work.

Thanks for reading. If you like this article then give a Thumbs up. Don't Forget to write your opinion in the comment box and if you think that this article will help any of your friends then do share this article.

Share
Tweet
Pin
Share
No comments
History and Introduction of C++


In this article, we will see you what exactly is C Plus Plus. When it was developed and why? You know a bit of information about the history of the C++.

What exactly is C Plus Plus(CPP)?


All of you know that a computer is an electronic device that can perform many computational tasks. However, since it is a machine, these computers really can't do anything on their own. So to get any job done using the computer, we need to give instructions to this computer, and according to our guidelines, these computers will work. These instructions which are provided to this computer are called the “Program,” and the person who writes these instructions or who is going to give these instructions is called as a “Programmer.”

The language in which these instructions are written, or these programs are written is called as the “Programming Language.” So here the programmer will use any of the programming language available and write the computer program or the instructions, and according to this program, the computer will work. So here C Plus Plus is one of the programming languages that can be used to write computer programs. There are many programming languages available. For example, we have C, we have C Sharp, we have Java, we have PHP, and we have Python. You know many programming languages are available, and C Plus Plus (CPP) is one of the programming languages. All Right.

Why this C++ was created and when?

This C Plus Plus programming language was created by “Bjarne Stroustrup” and his team in 1979 at the Bell Laboratories of New Jersey. When this language was created, they didn't directly call it as “C Plus Plus” Instead they called it as “C with classes.” During the 1970s C programming language was one of the most used and the most popular programming language, and even to this day, the C programming language is one of the most famous programming languages. However, the C programming language has its limitations. Year by year the computational capacity of the computers increased and also the programming complexity increased.

The problem with C programming language was as the programming complexity increased and the programs tend to become larger; it was difficult to manage and write the code using the C language for those complex computational task. So Bjarne Strostroup and his team they started working on the C programming language they added many features, the main feature they added was the object-oriented programming features and then they created this new language called as “C with classes.”

This “class” it is a part of the object-oriented programming. This object-oriented programming is an entirely different programming approach from the programming approach used in the C language. The object-oriented programming features which were added to this “C with classes” was mainly influenced by another object-oriented programming language which was existing during that time called as the SIMULA-67. Now this new language “C with classes” had the features from two great programming languages some peculiarities from the C programming language and also it had some peculiarities from the SIMULA-67.

The new language which was created in which is the “C with classes” was a better choice for writing the programs where the programmers have to perform some Complex programming operations. And after that in 1983 they renamed this “C with classes” with “C++” Now the exciting thing is this ++ it is actually an operator from the C language and this ++ is an increment operator and since this new language is an incrementation or the next step of the C language they named it as C++. So this is about some information about what exactly is C Plus Plus and about its history. 

Now if you like this article then give a Thumbs up. Don't Forget to write your opinion in the comment box and if you think that this article will help any of your friends then do share this article.

Share
Tweet
Pin
Share
No comments

About me

I am a Passionate Blogger. I am a student of Bachelor of Science in Software Engineering (BSSE) at UOS. I am learning C++ Programming Language. I wants to share what I have learned and my programs that's why I created this blog. Hope you guys will find it useful.

Follow Us

  • facebook
  • instagram
  • twitter

Categories

recent posts

Facebook

Contact Form

Name

Email *

Message *

Created with by ThemeXpose | Programming Vital | Disclaimer| Terms and Conditions