Q:

C program to print character without using format specifiers

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now