The format specifier %c is used in C and C++ to print a single character when using functions like printf.
Purpose:
- Display Characters: It allows you to output a character variable or a character literal.
Example:
Here's a simple example demonstrating its use:
#include <stdio.h>
int main() {
char letter = 'A';
printf("The character is: %c\n", letter);
return 0;
}
Output:
The character is: A
In this example, the character A is printed using the %c format specifier. If you have more questions or need further examples, feel free to ask!
