C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs



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.







You may also be interested in...

C/C++ Tips and Tricks...

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.


Comments and Discussions