Use the conversion specifier %c to output char type as a character rather than an integer. - C Data Type

C examples for Data Type:char

Introduction

The %c conversion specifier outputs the contents of the variable as a single character.

The %d specifier interprets it as an integer.

Demo Code

#include <stdio.h>

int main(void)
{
  char first = 'T';
  char second = 63;

  printf("The first example as a letter looks like this - %c\n", first);
  printf("The first example as a number looks like this - %d\n", first);
  printf("The second example as a letter looks like this - %c\n", second);
  printf("The second example as a number looks like this - %d\n", second);
  return 0;/*www. j  ava  2s  . co m*/
}

Result


Related Tutorials