DATA TYPES IN C Language . BY: Group No-3 Students: Arnav Dua Bhavik Aneja Varun Sharma Vedansh Shrivastava Karan Sethi
Data type is a type of data which is used in program to declare a variable. Data type specify how we enter data in our program . WHAT ARE DATATYPES
There are two types of data types: 1. Primary 2. Secondary .int .array .char .pointer .double .structure .float .union
PRIMARY DATATYPES: 1.) CHAR: C uses char type to store characters and letters as variables. For Example: Output:
2.) INT : Integer is defined as a number which has no fractional component. Numbers which have a fractional component is known floating point numbers. The range of int datatype lies between -2147483648 to 2147483647. Output:
3.) FLOAT : Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits . Output:
4.)DOUBLE : The double data type or double refers to that data type in the C language that helps in storing high-precision sorts of floating-point numbers or data in the computer memory. This data type is also known as double because it is capable of holding double the size of info and data as compared to the float. Output:
SECONDARY DATATYPES: 1.) A rray : Array in C can be defined as a method of clubbing multiple entities of similar type into a larger group. These entities or elements can be of int, float, char, or double data type or can be of user-defined data types too like structures. Arrays have 0 as the first index, not 1. 2.) P ointer : A pointer is a variable that stores the memory address of another variable as its value. A pointer variable points to a data type (like int ) of the same type, and is created with the * operator. 3.) Structure : Structures (also called structs) are a way to group several related variables into one place. Each variable in the structure is known as a member of the structure. Unlike an array, a structure can contain many different data types (int, float, char, etc.).
4.) Union : Union in C is a special data type available in C that allows storing different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multiple purposes.