You are on page 1of 13

# PRESENTATION TOPIC<Data Type>

# include< stdio.h >


int main()
{
// FROM
int a1= 33,a2=34,a3=45,a4=07,a5=21;
printf(“Rahat roll = %d\n”,a1);
printf(“Zayeed roll = %d\n”,a2);
printf(“Shormili roll = %d\n”,a3);
printf(“Muna roll = %d\n”,a4);
printf(“Salman roll = %d\n”,a5);
printf(“Batch 80 second semester\n”);
//TO
printf(“Honorable teacher\n”);
printf(“Sayma Sultana\n”);
printf(“Lecturer at DIU”);
return 0;
}
What is C Programming Language?
• Programming Language is a set of instruction for any
device. The device follow those instructions and run
their system according to the commands.

• C is a general-purpose programming language created


by Dennis Ritchie at the Bell Laboratories in 1972.

• The C is a general-purpose programming language


that is extremely popular, simple, and flexible to use.
It is a structured programming language that is
machine-independent and extensively used to write
various applications, Operating Systems like
Windows, and many other complex programs like
Oracle database
DATA TYPE :
Definition : A data type is an attribute that tells a computer how to interpret the value.
C provides several built-in data types, such as integer (int), character (char), floating-
point (float), and double-precision floating-point (double) and so on.
Advantages :
#include<stdio.h>
• Data type defines the size of a variable in memory. int main()
• Can create a user-defined data type using standard data type. {
• Identify the type of a variable when the variable is declared. int a;
printf(“%d” ,a);
• Identify the type of the return value of a function. Return 0;
• Identify the type of a Parameter expected by a function. }
Char Data Type:
• The Char data type stores character data in a fixed- #include<stdio.h>
length field. Data can be a string of single-byte int main()
or multi-byte letters, numbers, and other characters. {
• The char data type can also hold punctuation mark. char flag = “a” ;
There are also characters which are not printable in this printf(“%c” ,flag);
case by using escape symbol “\” Return 0;
( back slash character) then we can print those letter. }
• As there are singed and unsigned chars both occupy
1 byte each, but having different ranges.
• Unsigned characters have values between 0 and 255;
• Signed characters have values from -128 to 127.
Integer Data Type:
• An integer type variable can store zero, positive, and negative #include<stdio.h>
values without any decimal. int main()
• In C language, the integer data type is represented by the ‘int’ {
keyword, and it can be both signed or unsigned. int a = 8;
• By default, the value assigned to an integer variable is printf(“%d” ,a);
considered positive if it is unsigned. Return 0;
}
• The integer data type is further divided into short, int,
and long data types.
• The short data type takes 2 bytes of storage space; int takes 2
or 4 bytes, and long takes 8 bytes in 64-bit and 4 bytes in the
32-bit operating system.
Float Data Type:
• A float is a data type composed of a number that is
not an integer, because it includes a fraction #include<stdio.h>
represented in decimal format. int main()
• In C, float data type occupies 4 bytes (32 bits) of {
memory to store real numbers that have at least one float a = 6.88;
digit after the decimal point. A float data type can hold printf(“%f” ,a);
any value between 3.4E-38 to 3.4E+38. Return 0;
}
• The floating-point variable has a precision of 6
digits i.e. it uses 6 digits after the decimal point.
Void Data Type:
• The void data type always represents an empty set
of values. The only object that can be declared with
the type specifier void is a pointer. You cannot declare
a variable of type void , but you can explicitly convert
any expression to type void .
 It is used in three kinds of situations:
1. Function returns as void
There are various functions in C which do not return any value or you can say they return void. For
example – void exit ( int status);
2. Function arguments as void
There are various functions in C which do not accept any parameter. For example –
int rand (void);
3. Pointers to void
A pointer of type void * represents the address of an object, but not its type. For example, a memory
allocation function void *malloc( size_t size);
Array Data Type:
• Arrays are used to store multiple values in a single
variable, instead of declaring separate variables for
each value.
• To create an array, define the data type (like int)
and specify the name of the array followed by
square brackets[].
• To insert values to it, use a comma-separated list,
inside curly brackets.
• Array data type can be one or multi dimensional.
Pointer Data Type:
• A pointer is a variable whose value is the address of For better understanding
another variable i.e., the direct address of the memory
location. This variable can be of type int, char, array,
function, or any other pointer.
• The asterisk (*: the same asterisk used for
multiplication) which is indirection operator,
declares a pointer
 Types of pointers in ‘c’ are as follows:

• Null pointer
• Void pointer
• Dangling pointer
• Complex pointer
• Near pointer
• Far pointer
Enumerated Data Type:
• An enumeration is a data type that consists of a set of
named values that represent integral constants, known
as enumeration constants.

• An enum is defined by using the ‘enum’


keyword in C, and the use of a comma Keyword Name if enum
separates the constants within. The
basic syntax of defining an enum is:
enum enum_name{int_const1,
int_const2,int_const3….int_constN};
Separated by
commas
Typedef Data Type: Structure Data Type:
• The typedef is a keyword used in C • A structured type is a user-defined data type
programming to provide some containing one or more named attributes, each of
meaningful names to the already which has a data type.
existing variable in the C program. It
behaves similarly as we define the alias for
the commands.
New
name

Keyword

Data
type

You might also like