Data Types in C: Char

L&T Infotech Computer Programming Placement Papers

Data types: Char

Below you will find all the necessary information pertaining to the topic Data Types: Char

Introduction to Char

  • Char is used to store the single character.

  • Char can store digit, letter or special character.

  • We use ‘ %c ‘ for initialization of a character data type.

  • The range of the char data type varies from -128 to 255 as shown in the figure.
range char
data types in c: Char

Example of Char using C

#include<stdio.h>

void main()
{

char var;
printf("Enter the variable: ");
scanf("%c",&var);
printf("%c \n",var);

}