Data Types in C
Data Types in C
DATA TYPES
IN
C PROGRAMMING
_______________________________
PRESENTED BY
DEBANSHU MOHANTY
REDG. NO-220720100082
DATA TYPE:-
int main()
{
• Range: -32768 to 32767 // Integer value with positive data.
int a = 9;
• Size: 2 bytes or 4 bytes // integer value with negative data.
int b = -9;
• Format Specifier: %d // U or u is Used for Unsigned int in C.
int c = 89U;
// L or l is used for long int in C.
long int d = 99998L;
printf("Integer value with positive data: %d\n", a);
printf("Integer value with negative data: %d\n", b);
printf("Integer value with an unsigned int data: %u\n", c);
printf("Integer value with an long int data: %ld", d);
return 0;
}
// C program to print Integer data types.
#include <stdio.h>
Character Types
int main()
Character data type allows its variable to store only a {
all compilers.
a++;
•Range: (-128 to 127) or (0 to 255) printf("Value of a after increment is: %c\n", a);
// c is assigned ASCII values
•Size: 1 byte // which corresponds to the
// character 'c'
// a-->97 b-->98 c-->99
•Format Specifier: %c // here c will be printed
c = 99;
printf("Value of c: %c", c);
return 0;
}
Floating-Point Types // C Program to demonstrate use
// of Floating types
In C programming float data type is used to store floating-point #include <stdio.h>
•Size: 8 bytes
printf("%lf", c);
•Format Specifier: %lf
return 0;
}
Void Data types
The void data type in C is used to specify that no value
// C program to
is present. It does not provide a result value to its demonstrate
caller. It has no values and no operations. It is used to // use of void pointers
#include <stdio.h>
represent nothing. Void is used in multiple ways as
function return type, function arguments as void, and int main()
{
pointers to void.
int val = 30;
void *ptr = &val;
printf("%d", *(int
*)ptr);
return 0;
}
THANK YOU