What is data types | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is data types

9th Apr 2020, 5:08 AM
Mysterious X
Mysterious X - avatar
2 Answers
+ 3
type of data is stored in a container is called datatype. There are various types such as 1. To store character we use char 2. To store integer we use int datatype Let me give you a example :- #include <stdio.h> int main() { int a = 1; char b ='G'; double c = 3.14; printf("Hello World!\n"); //printing the variables defined above along with their sizes printf("Hello! I am a character. My value is %c and " "my size is %lu byte.\n", b,sizeof(char)); //can use sizeof(b) above as well printf("Hello! I am an integer. My value is %d and " "my size is %lu bytes.\n", a,sizeof(int)); //can use sizeof(a) above as well printf("Hello! I am a double floating point variable." " My value is %lf and my size is %lu bytes.\n",c,sizeof(double)); //can use sizeof(c) above as well printf("Bye! See you soon. :)\n"); return 0; }
9th Apr 2020, 5:22 AM
Riyaz Ali
Riyaz Ali - avatar