Thursday, April 18, 2019

C language : Datatypes



                Data types in C programming language

  Datatypes:-Data types in C refer to an extensive system used for declaring variable or functions of different types. The type of variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.
   There are two types of data types in C programming language.

1. Predefined data types
2. User defined data types

1. Predefined data types- pre defined data types are those data types which are already defined in C programming language. We cannot do any changes in this type of data types as it is fixed by the developers. There are five types of predefined data types which are described as follows:

1. int
2. char
3. float
4.  double
5.  void

 1.     int- int is used for integer value. It's size is two bytes which ranges from -32768 to 32767 for signed integer and 0 to 65535  for unsigned integer.
For eg.    int b;
                 int a=5;
2.    char- char is used for character value. It's size is one byte. It ranges from - 128 to 127 for signed characters and for unsigned character it is from 0 to 255.
 For eg. char a;
3.  float-float is used for floating point numbers or for fractional values. It's size is four bytes. It ranges from 3.4E-38 to 3.4E+38.
For eg.     float a=45.32;
4.  double-double is also used for floating point numbers but it's size is eight bytes. It ranges from 1.7E-308 to 1.7E+308.
For eg.    double b=3467.125478;
5.  void-void keyword has no value all we can say that it is valueless special purpose type.
    For eg.      void()

2.   User defined data types- user defined data types are those data types  which are defined by the user. Here we can make our own data types with the help of structure, Union, Enum, typedef.

No comments:

Post a Comment

Function

FUNCTION C enables programmer to break up a program into segments commonly known as functions, each of which can be written more or...