...

Programming languages - C++

Back to Course

Lesson Description


Lession - #36 C++ Variable Types


A variable gives us named storage that our projects can control. Every variable in C++ has a particular kind, which decides the size and design of the variable's memory; the scope of values that can be put away inside that memory; and the arrangement of activities that can be applied to the variable.

The name of a variable can be made out of letters, digits, and the underscore character. It should start with either a letter or a underscore . Upper and lowercase letters are particular in light of the fact that C++ is case-sensitive −
 

Sr.No Type & Description
1 bool
Stores either value true or false.
2 char
Typically a single octet (one byte>
. This is an integer type.
3 int
The most natural size of integer for the machine.
4 float
A single-precision floating point value.
5 double
A double-precision floating point value.
6 void
Represents the absence of type.
7 wchar_t
A wide character type.

Variable Definition in C++

A variable definition advises the compiler where and how much capacity to make for the variable. A variable definition determines an data type, and contains a rundown of at least one variables of that sort as follows −
 

type variable_list;

Some valid declarations are shown here −
 

int    i, j, k;
char   c, ch;
float  f, salary;
double d;

 

 

 

 

 


The main diff between C and C++ is that C is a procedural programming language that does not support classes and objects.
object oriented concepts: encapsulation, abstraction, inheritance, and polymorphism.
cpp list is a contiguous container while vector is a non-contiguous container i.e list stores the elements on a contiguous memory.
Best IDE for C Programming Language: Top Picks · #1>
Code:: Blocks · #2>
Tabnine · #3>
Eclipse · #4>
CLion · #5>
Visual Studio Code · #6>
NetBeans