As we know that there are various format specifiers in C like %d, %f, %c etc, to help us print characters or other data types. We normally use these specifiers along with the printf() function to print any variables. But there is also a way to print characters specifically without the use of %c format specifier. This can be obtained by using the below-shown method to get the character value of any ASCII codes of any particular character.
Example:
// Prints characters without format specifiers #include <stdio.h> int main() { printf("\x47 \n"); printf("\x45 \n"); printf("\x45 \n"); printf("\x4b \n"); printf("\x53"); return 0; } |
Output:
G E E K S
This article is contributed by Chinmoy Lenka. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Format specifiers in C
- Format specifiers in different Programming Languages
- C program to print a string without any quote (singe or double) in the program
- Write a C program to print "Geeks for Geeks" without using a semicolon
- C Program to print numbers from 1 to N without using semicolon?
- Write a C program to print "GfG" repeatedly without using loop, recursion and any control structure?
- C program to invert (making negative) an image content in PGM format
- C program to write an image in PGM format
- How will you print numbers from 1 to 100 without using loop?
- Print "Even" or "Odd" without using conditional statement
- Print substring of a given string without using any string function and loop in C
- Print individual digits as words without using if or switch
- Print "Hello World" in C/C++ without using any header file
- How to print a semicolon(;) without using semicolon in C/C++?
- How to print a number 100 times without using loop and recursion in C?
- Print a number 100 times without using loop, recursion and macro expansion in C?
- How will you print numbers from 1 to 100 without using loop? | Set-2
- C program to copy string without using strcpy() function
- Print 1 to 100 in C++, without loop and recursion
- How to print range of basic data types without any library function and constant in C?

