Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <limits.h>
- int main()
- {
- int a;
- long long int tot;
- float num;
- int div0, div1;
- printf("Short limit %d", SHRT_MAX);
- printf("\nInteger limit %d", INT_MAX);
- printf("\nLong limit %ld", LONG_MAX);
- printf("\nLong long limit %lld\n\n", LONG_LONG_MAX);
- a = INT_MAX * 10;
- printf("\ta overflow = %d", a);
- a = INT_MAX;
- printf("\n\ta = %d", a);
- tot = a * 10;
- printf("\n\ttot no casting = %lld", tot);
- tot = (long long)a * 10;
- printf("\n\ttot casting = %lld", tot);
- div0 = 35;
- div1 = 3;
- num = div0 / div1; // 11,66666666666667
- printf("\n\tnum no casting %f", num);
- div0 = 35;
- div1 = 3;
- num = (float)div0 / div1; // 11,66666666666667
- printf("\n\tnum casting %f\n", num);
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement