capypad
0 day streak
c / beginner
Snippet

Variable Data Types

In C, you must declare the type of data a variable will hold, such as integers (int), floating-point numbers (float), or single characters (char).

snippet.c
c
1
2
3
int age = 25;
float temperature = 36.5;
char grade = 'A';
Breakdown
1
int age = 25;
Declares an integer variable named 'age' and assigns it a value.
2
float temperature = 36.5;
Declares a decimal number variable.
3
char grade = 'A';
Declares a single character variable using single quotes.