Different types of variable

Different types of variable







1)      Defining Integer Variables
            Integer variable are used to stored numeric data as integer constant and exist in different size, but the most commonly used is type int. this types requires two bytes of storage and holds whole number in the range -32,768 to 32,767. Consider the following program.
              // this program demonstrates integer variable.
                 #include <iostream.h>
                 Void main ()
                  {
                 Int          a1, a2;
                 Int          b1;
                 A1 = 20;
                 A2 = a1 + 10;
                 Cout << “a1 +10 is =”;
                 Cout << a2;                 }
 

Different types of variable
Different types of variable







 
1)      Defining Character variable:
Character variable are used to stored character data as character constant as exit in different size, but the most commonly used in the type char. This types requires one bytes of storage and hold only a single character. This types of integer data that range in value from -128 to 127. Character variable are sometimes used the store number that confine themselves to this limited range., but they are more commonly used to store ASCII characters.
// this program demonstrates character variables.
#include <iostream.h>
Void main()
                       {  
                      Char    C1     ,    C2;
                     Char     P1;
                     C1    =   ‘Q’;
                     C2    =   ‘$’;
                     P1    =   ‘+’;
                     Cout  <<C1 << end1  <<C2;
                     Cout << P1 << endl;
                      }

Post a Comment

0 Comments