Created
May 20, 2017 23:44
-
-
Save samueltcsantos/d48a027bbd9e871f75cc103a95dcb0e4 to your computer and use it in GitHub Desktop.
Trying to do underflow and overflow in C language for the integer Type.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
int main(){ | |
int maxValue = INT_MAX; | |
int minValue = INT_MIN; | |
int overflow = 0; | |
int underflow = 0; | |
printf("\nMin INT %d \n", minValue); | |
underflow = minValue - 1; | |
printf("Underflow is %d \n ", underflow); | |
printf("\nMax INT %d\n", maxValue); | |
overflow = maxValue + 1; | |
printf("Overflow INT %d \n ", overflow); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment