
In C programming, there are several fundamental data types you can use to declare variables. Hereās a list of the common ones:
int: This is used for storing integers, which are numbers without decimal or fractional parts. For example:
int age = 25;Here,ageis a variable of typeintthat stores the value25.float: This type is for floating-point numbers, which are numbers with decimal points. For example:
float height = 5.9;In this case,heightis afloatvariable holding the value5.9.double: Similar to
float, but used for double-precision floating-point numbers, which offer more precision. For example:double pi = 3.14159;char: This is used to store single characters. For example:
char grade = 'A';void: This type is often used for functions that do not return a value, rather than for variables.
Each of these data types serves a different purpose depending on the kind of data you want to store.
If you have more questions about these data types or how to use them, feel free to ask!
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer
