Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing a character in C
#1
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".
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Handling character input in C Qomplainerz 0 407 07-26-2023, 07:49 AM
Last Post: Qomplainerz
  Storing a single character in C Qomplainerz 0 362 07-26-2023, 07:45 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 7 Guest(s)