Ccpp Variables — Free C Cpp Tutorial
Learn Ccpp Variables in C Cpp with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Ccpp Variables in C Cpp with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Ccpp Variables in C Cpp
C is statically typed: you must declare a variable's type before using it, and it cannot change. The core types are int (whole numbers), float and double (decimals, double is more precise), char (a single character, stored as a small integer), and in C99 _Bool / <stdbool.h> for true/false. A type also fixes how many bytes the variable occupies in memory.
printf uses format specifiers to insert values: %d for int, %f for float/double, %c for char, %s for a string, %.2f to show 2 decimal places. The number of specifiers must match the arguments you pass — a mismatch is a classic bug that prints garbage.
Integer division truncates: 7 / 2 is 3, not 3.5, because both operands are ints. To get 3.5 at least one operand must be a floating type (7.0 / 2). This trips up almost every beginner.
Learn Ccpp Variables step by step with Syllab's free interactive C Cpp tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full C Cpp course →