Home » C programs

‘unsigned char’ - Declaration, Assign and Usage in C programming

Here, we are going to learn about unsigned char: why, where and how it is used? We are demonstrating use of unsigned char through an example in C programming language.
Submitted by IncludeHelp, on May 05, 2018

char is a data type in C programming language which can store value from -128 to +127. It generally used to store character values.

unsigned is a qualifier which is used to increase the values to be written in the memory blocks. For example - char can store values between -128 to +127, while an unsigned char can store value from 0 to 255 only.

unsigned store only positive values, its range starts from 0 to (MAX_VALUE*2)+1.

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 syntax:

unsigned char variable_name;

Declaration example:

unsigned char age;

Program to read and print the unsigned char value in C

#include <stdio.h>

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


Enter age: 75 
Input age is: 75 


Comments and Discussions!





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.