Topics
Number Systems
Program Analysis
Introduction to C+ +
- Introduction to C++
- Character Sets
- Standard I/O Strems in C++
- Type Modifiers
- C++ Data Types
- Variables in C++
- Constants
- Compiler Tokens
- Operators in C++
- Comments in C++
- Scope and Visibility
- Control Statements
- Functions in C++
- Default Arguments
- Techniques used to pass Variables into C++ Functions
- Function Overloading
- Inline Functions
- Recursion
- Pointers in C++
- Arrays in Data Structure
- References
- Type Conversion in Expressions
Visual Basic
Introduction to Networking and Internet
- Introduction to Networking Technology
- Networking Terms and Concepts
- Concept of Computer Network
- Network Security
- Network Applications
Variables in C++
A variable in C++ is a named storage location in memory that holds a value that can be modified during the execution of a program. Variables are fundamental components in any programming language, and they are used to store data, perform operations, and manage the flow of information in a program.
The syntax for variables : data-type var1 , var2
The rules for constructing variable names of all types are same
- The variable name is any combination of alphabets, digits, and underscores.
- The variable name cannot start with a digit.
- Uppercase and lowercase letters are distinct.
- No special symbol other than underscore can be used in a variable name.
- There is no limit on the length of the variable name.
For example :
Valid variables: i , count , si_int
Invalid variables: $200 , L1 , 1S
Declaration of variables
Variable declaration in C++ is the process of specifying a name and a data type for a variable so that the compiler reserves appropriate memory space it can be declare anywhere in a program before it is use
- It tells the compiler what the variable name is.
- It specifies what type of data the variable will hold
The syntax for declaring a variable is:
data - type: v1, v2, v3...vn;
For example : float average;
int x;
double ratio;
