#C_language #c++ #variables #c_programming
Welcome back to the series of introduction to computer programming in this video we will discuss about the variables the variables are the fundamental concepts in computer science so the question is what is a VARIABLE? Variable is a name given to a memory location inside our computer where we can store data as the name
suggests the data stored by a variable can be varied so which type of data can a variable hold
In c or c plus plus we have many data types for example integer character float double long shot wide character and there are some more we will discuss about the data types in upcoming videos first of all we will look into what is a variable declaration
The process of specifying the variable name and its type is called variable declaration
we have to tell the compiler about the type of data we are going to stored in the variable that can be integer float character or string the compiler used the declaration to determine how much memory is needed for each variable for example if we are using a character one byte of memory is required by the compiler for integers two or four bytes of memory depending on the compiler and operating system nowadays mostly compiler used 4 byte of memory for integers in c++. If you want to use some variables they
must be declared before they are used in the program let's look at the syntax at first we have to determine the data type of the variable after that a space and now the name of the variable this name should be meaningful after the name we have to use a semicolon there are certain rules in the naming of the variable a variable name can consist of letter digits and underscore the first letter of a variable should be either a letter or underscore no digits can be used at the start of the name of a variable we cannot use space and variable names the length of a variable name should not exceed 31 characters as some compilers may run into problem for example integer sum here int indicates the type of the data we can stored in the variable that is of integer type and basically integer holds some values and the name here we are using as sum it refers to the memory location of the variable where the value or integer value can be stored
hope this is informative for you
thanks for watching.
ALLAH Hafiz
In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction s that tell the computer what to do and data that the program uses when it is running.