To print any variable in C, you need to provide the format specifier with the printf() function. Without format specifiers, the printf() function will not display anything.
A format specifier tells the C compiler the type of data the variable is storing and it starts with a percentage sign (%), followed by a character.
Format specifiers for integer, float, character, and string are as follows:
%c: a single character
%s: a string
%d: a decimal integer
%f: a floating point number
Here is an example to show the use of format specifiers:
#include <stdio.h>
int main() {
int n = 125; // Integer
float f = 15.24; // Floating point number
char c = 'A'; // Character
char name[] = "Airplane"; // String
// Print variables
printf("%d\n", n);
printf("%f\n", f);
printf("%c\n", c);
printf("%s\n", name);
return 0;
}