data type & declaration




Basic data type

The basic data types are datatypes already defined in the programing language

Youtube tutorial:



Declaring variable
All varaiable present in the program must be declared before it is used.
The generalform is
data-type variable list;




Initializing variables
 The process of assigning initial value to variable during declaration is called initializing variable
The general form is,
data-type variable = initial value;

Example
int a = 10;



Assigning value to variables
giving values to variable is called assigning values to variable
The general form is
variable-name = value;

Example
a=10;
cd=25;



Declaring variable as constants
A constant is quality whose value does not change during program execution
The general form is
const data-type variable = value;

where
   const  -- keyword
   data-type -- int,float,etc..
Example
   const int smoke = 0;



Declaring varabile as volitile
The general form to declare a variable as volatile is

volatile data-type variable;

where
  volatile   -- keyword
  data-type  -- such as int,float,etc..

Example
volatile int x;


Defining symbolic constants
Symbolic constant are usually defined at the begning of program its a name that can be  substituted for a value that cannot be changed the value can be a numberic constant during the compilation of program each occurance of symbolic constant will be replace by its value

The general form is
#define name value;

where
#define - preprocessor directive
name - valid identifier name
value - a number value
Example
#define book 2



Youtube tutorial:

Comments

Popular posts from this blog

operators in c program

nested-if

switch-statement