Initialize a variable of type char with an integer value. - C Data Type

C examples for Data Type:char

Introduction

As long as the value fits into the range for type char with your compiler, you can use int value to initialize a char type variable.

Demo Code

#include <stdio.h> 
  
int main(void) { 
    char letter = 74;                        // ASCII code for the letter J
    //from w  w  w  .  j a  va2s. c  om
    printf("The character is %c\n", letter);
    
    printf("%d",letter);
    
    return 0; 
} 

Result


Related Tutorials