What is Data type. Why we are using Data types in programming languages like c java C++ etc.Without data types we can write or we can't our programs in particular language. For example in our school life we learn numbers 1,2,3, and learn letters A,a,B,b,--etc. while using those numbers and letters we can read the books, calculate our daily life expenditure and income what ever it.If we know letters A,B,C -- then only we read Books. Same way while you writing programs in particular language you have to know given data is which Data Type .So here we are learning Data Types in c language. what we learn in our childhood to now different types of data that is numbers,letters, those are referred in a particular format or particular Data type in programming languages.
C language is rich in its data types. Storage representations and machine instructions to handle constants differ from machine to machine.
C language is rich in its data types. Storage representations and machine instructions to handle constants differ from machine to machine.
What is Data type in C programming
A Data type is a Type of Data. Data type is a storage format that can contain a specific type or range of values.When computer programs store data in variables each variable must be assigned a particular or specific data type.
Csupports four types of data types.
- Primary data types
- User-defined data types
- Derived data types
- Empty data set
All C Compilers support four primary data types.
- Integer
- Character
- Float
- Double
Many of them also offer extended data types such as long intand long double.
![]() |
| Datatypes-in-c |
Integer Types
Integers are whole numbers with a range of values supported by a particular values supported by a particular machine. generally integers are occupy one word of storage, and the size of an integer that can be stored depends on the computer.If we use a bit 16 bit word length,the size of the intger value is limited to the range -32678 to +32767(that is -215to +215-1).Similarly, a 32 bit word length can be store an ranging from -2,147,483,64888 to 2,147,483,647.
Floating Point data types
Floating point numbers are stored in 32 bits(on all 16 bits and 32 bit machines),with 6 digits of precision. Floating point numbers are defined in c by the keyword float.This will stores on float pointing value.The range of the float data type is 3.4e-38 to 3.4e +38.
Double data type
Double data type stores the long range floating values.A double data type number uses 64-bits giving a precision of 14 digits.These are known as double precision numbers.The range of double data type is1.7e-308 to 1.7e+30888.
Character Data Type
A single character can be defined as character(Char) type dfata. Characters are usually stored in 88 bits(one byte) of internal storage.The qualifier Signedor unsigned may be explicitly applied to char.while unsigned charshave values between 0 to 255signed chars have values form -128 to +127.
user-Defined Type
C supports a feture know as "type definition" that allows users to define an identifier that would represent an existing data type.
Ex:typedeftypeidentifier
In above Example type refers to an existing data type and"identifier" refers to the "new "name given to the data type.The existing data type may belong to any class of type, including the user-defined ones.Rember that the new data type is "new" only in name, but not the data type.typedefcannot create new type. Here i am providing some example of type definition are: Ex:typedef intunits; typedef float marks; Here,unitssymbolizes intand markssymbolizes float. Note:The main advantage of typedef is that we can create meaningful data type names for increasing the readability of the program.
Derived data type
User can derive the data types from primary data types.those are Arrays,Functions,Structures.we can learn those in our Arrays and Functions lesions.


thank you
ReplyDelete