Unsigned char in C - ‘unsigned char’ for Memory Optimization in C Programming



 ‘unsigned char’ for Memory Optimization in C Programming

Learn c - c tutorial - ‘unsigned char’ for Memory Optimization in C Programming - c examples - c programs

‘unsigned char’ for Memory Optimization in C Programming

  • Developers use int to store integer values without thinking about data range and the data range is less than value and use (unsigned char).

Sample Code

#include <stdio.h>
int main()
{
    unsigned char value=0;
    printf("Value is: %d\n",value);
    value=50;
    printf("Value is: %d\n",value);
    value=255;
    printf("Value is: %d\n",value); //if the value is greater than 255
    value=300;
    printf("Value is: %d\n",value);
    return 0;
}

Output

Value is: 0
Value is: 50
Value is: 255
Value is: 44

View More Quick Examples


Related Searches to Unsigned char in C - ‘unsigned char’ for Memory Optimization in C Programming