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

C program prints characters without using format specifiers

王林
Release: 2023-09-10 10:01:09
forward
765 people have browsed it

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
}
Copy after login

Output

A
R
i
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template