Variables in C++
A variable is a storage location having a name that can hold a value of a specific data type.
- A variable can be of any data type.
- Variables must be declared before they can be used.
- Multiple variables can also be declared at one time.
- The name of a variable can contain alphabets, digits, and an underscore but the name of a variable must start with an alphabet or an underscore.
Identifiers: All variables in a program must be given unique names which are known as the identifiers so each variable can be identified uniquely.
Constants: Constants are the fixed values that remain unchanged during the execution of the program.
Syntax to Declare a variable
// Declaring a single variable
data_type variable_name;
// Declaring multiple variables
data_type variable1_name, variable2_name, variable3_name;
C++ Cheatsheet
This is a C++ programming cheat sheet. It is useful for beginners and intermediates looking to learn or revise the concepts of C++ programming. While learning a new language, it feels annoying to switch pages and find different websites for different concepts that are easily understandable. You can learn C++ concepts very easily using this cheat sheet.
C++ is a high-level programming language. It was developed in 1983 by Bjarne Stroustrup at Bell Labs. It is used for developing various applications.