HOW MANY TYPS OF DATA TYPES IN C?

0







  • DATA TYPES






    Each variable in C has an associated data type. Each data type requires different amounts of memory and has some specific operations which can be performed over it. Let us briefly describe them one by one( Click on Data Types to know more...:


    1. PRIMITIVE DATA TYPES/ Build In Data Types







      This is pre-defined Data types.These is a basic five data types. Every C compiler supports five primary data types:



      1. Integer
        It is used for non-decimal values.Used to denote an integer type. int (2 byte) can store values from -32,768 to +32,767 int (4 byte) can store values from -2,147,483,648 to +2,147,483,647. If you want to use the integer value that crosses the above limit, you can go for “long int” and “long long int” for which the limits are very high. Syntax With Variable name :-int <-- name--="" variable=""> With Long : long int <-- name--="" variable=""> With Functions name:-int <--function-name--><--function-arg-->


      2. Void
        As the name suggests, it holds no value and is generally used for specifying the type of function or what it returns. If the function has a void type, it means that the function will not return any value. Syntax void <--function-name--><--function-arg-->

      3. Char
        Used to denote a character type. Like A-Z,a-z,0-9,A-z(ASCII),special character($,#,@,%,^,& etc...) Storage Size:1 byte | Range of Value 28-1 Syntax With Variable name :-char <-- name--="" variable=""> With Functions name:-char <--function-name--><--function-arg-->






      4. Float,Double
        It is used to denote a floating point type. .Used to denote an float type. Storage Size: 4 bytes | Range of Value -3.4E+38 to +3.4E+38 Syntax With Variable name :-float <-- name--="" variable=""> with Variable name: double <--variable name--=""> with Functions name : double <--function-name--><--function-arg--> With Functions name:- float <--function-name--><--function-arg-->






      5. int *,float *,char *
        It is used Used to denote a pointer type. Syntax With Variable name :-float * /int */char * <-- name--="" variable=""> With Functions name : float */int */char * <--function-name--><--function-arg-->









    2. NON-PRIMITIVE DATA TYPES/ Derived Data Types








      That Data types name automatically suggest. This data types derived from using Build-In Data types


      1. Arrays
        Arrays are sequences of data items having homogeneous values. They have adjacent memory locations to store values. Syntax With Variable name :-int <-- name--="" variable=""> [ Size ];






      2. References
        Function pointers allow referencing functions with a particular signature.






      3. Pointers
        These are powerful C features which are used to access the memory and deal with their addresses. Syntax With Variable name :-int * variable With function : int * <--function name--=""><--function--arguments-->










    3. User-Define Data types








      C allows the feature called type definition which allows programmers to define their identifier that would represent an existing data type. There are three such types:


      1. Structure
        It is a package of variables of different types under a single name. This is done to handle data efficiently. "struct" keyword is used to define a structure. struct keyword used for creating Structure. Syntax struct <--structure-name--> {Structure body}; struct <--structure name--=""> variable name;






      2. Union
        These allow storing various data types in the same memory location. Programmers can define a union with different members, but only a single member can contain a value at a given time. It is used for Syntax union <--union-name--> {union body}; union <--union-name--> variable name;






      3. Enum
        Enumeration is a special data type that consists of integral constants, and each of them is assigned with a specific name. "enum" keyword is used to define the enumerated. Syntax enum <--enum-name--> { Enum body}; enum <--enum-name--> <--variable-name-->














Coding : Written Code(Primitive Data Type)



ContentsPractical Videos

Build In Data Types




Derived Data Types




User-Define Data Types

Structures



Union



Enum

SOON Comming

Post a Comment

0Comments

We you have any doubt let me know :)

Post a Comment (0)
To Top