QP School
Printing a character in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Printing a character in C (/showthread.php?tid=5136)



Printing a character in C - Qomplainerz - 07-26-2023

Example:

char letter = 'B';
printf("The letter is: %c\n", letter);

Explanation:

In this example, we declare a variable letter of type char and assign it the character 'B'.
We use the %c format specifier in the printf() function to print the value of the char variable.
When the printf() function is executed, it will replace %c with the value of letter and print "The letter is: B".