Showing posts with label basic data types in c programming language. Show all posts
Showing posts with label basic data types in c programming language. Show all posts

Thursday 8 March 2018

Data types in C programming

  Data types in c:-

                                                       
  C supports three types of data :-
  • Primary Data Types (Built-in):-
Integer types:-  
It  used to decleare both positive and negative values but no decimal v     alues. Example: 0, -6, 10
For example:
int a=3;

Floating type:-


Floating type variables can hold real numbers such as: 5.34, -8.382, 9.0 etc. 

You can declare a floating point variable  by using float or double keyword. 



For example:

float amount=10.5;
double  amount= 58.9;

Character type


Keyword char is used for declaring character type variables.

For example:

char demo = 'm';

Here, demo  is a character variable. The value of demo is 'm'.

The size of character variable is 1 byte.


  •  Derived types:-
         Arrays
           Pointers
          Structures
          Enumeration



Difference between float and double


The size of float  is 4 bytes. And the size of double is 8 bytes. Floating point variables has a precision of 6 digits whereas the precision of double is 14 digits.









For more info click here