Overflow in char and unsigned char data types : char Calculation « Data Type « C Tutorial






Overflow means you are carrying out an operation such that the value either exceeds the maximum value or is less than the minimum value of the data type. (Definition from C & Data Structures by P.S. Deshpande and O.G. Kakde Charles River Media 2004)

#include <stdio.h>
main()
{
    char i,j ;
    i = 1;
    while (i > 0){
        j = i;
        i++;
    }
    printf ("the maximum value of char is %d\n",j);
    printf ("the value of char after overflow is %d\n",i);
}
the maximum value of char is 127
      the value of char after overflow is -128








2.14.char Calculation
2.14.1.Overflow in char and unsigned char data types
2.14.2.Converting uppercase to lowercase
2.14.3.Compare characters to characters in if statement
2.14.4.Checking for Upper- and Lowercase
2.14.5.Compare char variable in if statement