Home / Programs / Character format specifier : %c Example program
Programming Example

Character format specifier : %c Example program

👁 1,007 Views
💻 Practical Program
📘 Step by Step Learning
Character format specifier : %c

Program Code

#include <stdio.h> 
int main() 
{ 
    char ch = 'A'; 
    printf("%c\n", ch); 
    return 0; 
} 

Output

A

Explanation

Character Format Specifier %c

The %c format specifier is implemented for representing characters. This is used with printf() function for printing the character stored in a variable. When you want to print a character data, you should incorporate the %c format specifier.

Syntax:

 
 printf("%c",<variable name>);

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.