Variable & Datatype for C-programming

Variable & Datatype for C-programming

                                 5

Variable:- Whose value change is known as variable.You can use some specific variable.

Ex:-a,b,c
       A,B,C
       a1,b2

But 1a,2b, space, special character are  not allowed.
Underscore is allowed.

Datatype:-Before declaration variable you need to define the type of variable i.e. integer, character, float etc


Variable declaration:-You can define a variable in following way.


Syntax:-datatype  variablename;



Eg:-int x;
       int a;
       float q;

Variable intialization:-In this step you have to give the value of variable.


During character intialization write character within the '   '

Eg:-int x=1; or
int x;
x=1;
     

Datatype:-Datatype definition the nature of variable.

It is mainly three types.

1.Integer
2.Character
3.Float

1.Integer datatype:-It represent integer value.
And expressed as %d;

Data Type      Size in bytes        Rangeshort
short                2                     -32768 to +32767
int                     2                    -32768 to +32767 unsigned int    2                        0 to 65536
long                  4                       -2147483648 to                                                         +2147483647     unsigned
long int            4                 0 to 4,294,967,295

2.Float datatype:-It represent negative values.

Data Type      Size in bytes        Rangeshort
float                4                    3.4E-38 to 3.4E+38
double            8               1.7E-308 to 1.7E+308
long               10          3.4E-4932 to 1.1E+4932
double 

3.character:-It is used to represent character value.

Data Type      Size in bytes        Rangeshort
char                     1                      -128 to +127 signed char         1                         -128 to +127
unsigned char     1                             0 to 255

                             End

If you like this content then you can share it and for any issues you can direct contact with me from Home Page.

For regular updates you can also follow my site.

  <=Back
                     

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to show present time and date in C-language

Introduction of C-language.

Program to cheque enter number is a perfect number or not using if else in C-language

Program to cheque four digits number is palindrome or not in C-language

Program to print the cube of a number in c-language

Simple Hello world program in c- language