Variables in C are associated with data type. Each data type requires an amount of memory and performs specific operations.
There are some common data types in C −
int − Used to store an integer value.
char − Used to store a single character.
float − Used to store decimal numbers with single precision.
double − Used to store decimal numbers with double precision.
#include <stdio.h>
int main() { // datatypes int a = 10; char b = 'S'; float c = 2.88; double d = 28.888; printf("Integer datatype : %d\n",a); printf("Character datatype : %c\n",b); printf("Float datatype : %f\n",c); printf("Double Float datatype : %lf\n",d); return 0;
No comments:
Post a Comment