07-26-2023, 07:46 AM
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".
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".