Type cast numbers to characters and characters to numbers - C Data Type

C examples for Data Type:Type Cast

Description

Type cast numbers to characters and characters to numbers

Demo Code

#include <stdio.h> 
int main()/*  ww  w .  j a  va2 s  .  c o  m*/
{ 
   int number = 86; 
   char letter = 'M'; 
   printf("\n86 type-casted to char is: %c\n", (char) number); 
   printf("\n'M' type-casted to int is: %d\n ", (int) letter); 
}

Result


Related Tutorials