ในบทความนี้เราจะดูวิธีพิมพ์ตัวอักษรโดยไม่ใช้ format specifiers ใดๆ format specifiers ใน C คือ %d, %f, %c ใช้พิมพ์ตัวอักษรและตัวเลขด้วย printf()
ที่นี่เราจะดูอีกวิธีพิมพ์ตัวอักษรโดยไม่ใช้ %c format specifier ทำได้โดยใส่ ASCII values โดยตรงในรูป hexadecimal
ตัวอย่างโค้ด
#include <stdio.h> main () { printf("\x41 \n"); //41 is ASCII of A in Hex printf("\x52 \n"); //41 is ASCII of A in Hex printf("\x69 \n"); //41 is ASCII of A in Hex }ผลลัพธ์
A R i