Home » C solved programs » Advance C programs

C program to print character without using format specifiers

As we know that, printf prints the character or any other type of value by passing format specifiers like %d, %c, %f, %ld, ... to print their corresponding value. But here is method by using this we can print the character value of any ascii code. In this program we will print character values without using format specifier %c.

Print characters without using format specifier - %c

/*C program to print character without 
using format specifiers.*/

#include <stdio.h>

int main()
{
    printf("\x41"); printf("\n");
    printf("\x42"); printf("\n");
    printf("\x43"); printf("\n");
    printf("\x44"); printf("\n");
    return 0;
}
    

Output

    A
    B
    C
    D

In this program, we are printing the value of 0x41, 0x42, 0x43, 0x44 these are the ASCII Codes of A, B, C, D respectively.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.