C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » Code Snippets » C/C++ Code Snippets

‘unsigned char’ declaration, read and print in c language

By: IncludeHelp On 20 DEC 2016

unsigned char is a character data type with larger range of the value than signed char.

Whenever we work with positive value between the range of 0 to 255, we can use unsigned char instead of short, int type of data type.

Declaration

unsigned char variable_name;
unsigned char age;





Consider the program to read and print the unsigned char value in C

#include <stdio.h>

int main()
{
	unsigned char age;
	
	printf("Enter age: ");
	scanf("%d",&age);
	
	printf("Input age is: %d\n",age);
	
	return 0;
}

Output

Enter age: 75 
Input age is: 75 

COMMENTS