Home >Backend Development >C++ >C program prints characters without using format specifiers

C program prints characters without using format specifiers

王林
王林forward
2023-09-10 10:01:09782browse

C program prints characters without using format specifiers

In this article we will see how to print some characters without using any formatting specifier. Format specifiers in C include %d, %f, %c, etc. These are used to print characters and Numbers in C use the printf() function.

Here we will see another way to print characters without using the %c format specifier. This is acceptable This is done by placing the ASCII value directly in hexadecimal form.

Sample code

#include <stdio.h>
main () {
   printf("\x41 </p><p>"); //41 is ASCII of A in Hex
   printf("\x52 </p><p>"); //41 is ASCII of A in Hex
   printf("\x69 </p><p>"); //41 is ASCII of A in Hex
}

Output

A
R
i

The above is the detailed content of C program prints characters without using format specifiers. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete