TAPASH kumar das its my college pptasjhk

destroyer7992 13 views 18 slides Oct 17, 2024
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

its my ppt


Slide Content

Under the guidance of Dr. Santosh Kumar Das ASSIGNMENT PRESENTATION 2022 DATA TYPE BY TAPASH KUMAR DAS [SBU220329] Department of Computer Science and Engineering Sarala Birla University, Ranchi, Jharkhand 835103

Outlines Introduction Types of Data Type Primary Data Type Derived Data Type User defined Data Type Conclusion

Introduction A data-type in C programming is a set of values and is determined to act on those values. C provides various types of data-types, allowing the programmer to select the appropriate type for the variable to set its value. The data-type in a programming language is the collection of data with values having fixed meanings and characteristics. Some of them are an integer, floating point, character, etc. Usually, programming languages specify the range values for a given data-type. There are 3 types of Data Type: Basic or P rimary Data Type Derived Data Type User Defined Data Type

TYPES OF DATA TYPE Primary Derived User Defined Integer Character Float Double Void Functions Array Pointer Reference Class Structure Union Enumeration Typedef

BASIC OR PRIMARY DATA TYPE INTEGER The integers in C are  whole numbers , that means it can hold all the values zero, positive and negative except decimal values. int keyword is used to declare or define integer variables. Unsigned int data type in C is used to store the data values from zero to positive numbers but it can’t store negative values like signed int. USES The integer data type in C is used to   store the whole numbers without decimal values . Octal values, hexadecimal values, and decimal values can be stored in int data type in C.

Data Type Size(bytes) Range Format Specifier unsigned short int 2 0 to 65,535 %hu short int 2 -32,768 to 32,767 % hd unsigned int 4 0 to 4,294,967,295  %u Int 4 -2,147,483,648 to 2,147,483,647  %d unsigned long int 8 0 to 4,294,967,295  % lu long int 8 -2,147,483,648 to 2,147,483,647  % ld unsigned long long int 8 0 to 18,446,744,073,709,551,615 % llu long long int 8 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 % lld

CHARACTER Character data type allows its variable to store only a single character. The storage size of the character is 1. It is the most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. TYPES OF CHARACTER The C programming language provides support for the following types of characters. In other words, these are the  valid  characters that we can use in the C language: Alphabets Digits Special Characters White Spaces

A LPHABETS The C programming language provides support for all the alphabets that we use in the English language. Thus, in simpler words, a C program would easily support a total of 52 different characters- 26 uppercase and 26 lowercase. Types of Character Description Characters Lowercase Alphabets a to z a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z Uppercase Alphabets A to Z A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z DIGITS The C programming language provides support for all the alphabets that we use in the English language. Thus, in simpler words, a C program would easily support a total of 52 different characters- 26 uppercase and 26 lowercase. Types of Character Description Characters Digits 0 to 9 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

SPECIAL CHARACTERS We use some special characters in the C language for some special purposes, such as logical operations, mathematical operations, checking of conditions, backspaces, white spaces, etc. The C programming language provides support for the following types of special characters: Types of Character Examples Special Characters ` ~ @ ! $ # ^ * % & ( ) [ ] { } < > + = _ – | / \ ; : ‘ “ , . ? WHITE SPACES The white spaces in the C programming language contain the following: Blank Spaces Carriage Return Tab New Line

FLOAT In C programming float data type is used to store floating-point values. Float in C is used to store decimal and exponential values. It is used to store decimal numbers (numbers with floating point values) with single precision. Data Type Size(bytes) Range Format Specifier Float 4 1.2E-38 to 3.4E+38 %f Double 8 1.7E-308 to 1.7E+308 %lf Long Double 16 3.4E-4932 to 1.1E+4932 %Lf DOUBLE A  double  is a data type in C language that stores high-precision floating-point data or numbers in computer memory. It is called double data type because it can hold the double size of data compared to the float data type. 

VOID The void data type in C is used to specify that no value is present. It does not provide a result value to its caller. It has no values and no operations. It is used to represent nothing. Void is used in multiple ways as function return type, function arguments as void, and pointers to void. For example:- void main() void main(void)

DERIVED DATA TYPE The data-types that are derived from the primitive or built-in datatypes are referred to as Derived Data Types. These can be of four types namely: Function Array Pointers References

FUNCTION A function is a block of code or program segment that is defined to perform a specific well-defined task. A function is generally defined to save the user from writing the same lines of code again and again for the same input. All the lines of code are put together inside a single function and this can be called anywhere required. main() is a default function that is defined in every program of C. ARRAY An array in C/C++ or be it in any programming language is a collection of similar data items stored at contiguous memory locations and elements can be accessed randomly using indices of an array.  They can be used to store the collection of primitive data types such as int, float, double, char, etc of any particular type

POINTERS Pointers in C are used to store the address of variables or a memory location. This variable can be of any data type i.e , int, char, function, array, or any other pointer. The pointer of type void is called   Void pointer  or  Generic pointer . Void pointer can hold address of any type of variable. The size of the pointer depends on the computer architecture like 16-bit, 32-bit, and 64-bit. REFERENCES When a variable is declared as a reference, it becomes an alternative name for an existing variable. A variable can be declared as a reference by putting ‘&’ in the declaration. 

USER DATA TYPE The data types that are defined by the user are called the derived datatype or user-defined derived data type. These types include: Class Structure Union Enumeration Typedef

CLASS It is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A class is like a blueprint for an object. STRUCTURE Structure in c is a user-defined data type that enables us to store the collection of different data types. Each element of a structure is called a member.  A structure creates a data type that can be used to group items of possibly different types into a single type.

UNION Union   can be defined as a user-defined data type which is a collection of different variables of different data types in the same memory location. The union can also be defined as many members, but only one member can contain a value at a particular point in time. ENUMERATION Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. TYPEDEF The typedef is a keyword that is used in C programming to provide existing data types with a new name. typedef keyword is used to redefine the name already the existing name. When names of datatypes become difficult to use in programs, typedef is used with user-defined datatypes, which behave similarly to defining an alias for commands.

Thank You……!
Tags