Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Language Examples - Printing a Single Character

C Language Examples - Printing a Single Character

C Language Examples C Language Examples

Use printf() with %c to format and output a single character.

Example

#include

<

stdio.h

int

main

(

)

{

char

c

;

// Declare a char variable

c

= '

A

';

// Define a char variable

printf

(

"

The value of c is %c

"

,

c

)

;

return

0

;

}

Output result:



c 的值为 A

C Language Examples C Language Examples