From 1cf5848e57e40b6df824e9d401b5f830fa46e011 Mon Sep 17 00:00:00 2001 From: SemkiShow Date: Sun, 22 Jun 2025 20:45:42 +0200 Subject: [PATCH] Fix minimum values of signed types in 1.ranges-of-variables.c --- .../1.ranges-of-variables.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter-2-types-operators-expressions/1.ranges-of-variables.c b/chapter-2-types-operators-expressions/1.ranges-of-variables.c index f715efc..efee146 100644 --- a/chapter-2-types-operators-expressions/1.ranges-of-variables.c +++ b/chapter-2-types-operators-expressions/1.ranges-of-variables.c @@ -23,13 +23,13 @@ main() printf("\nFrom calc:\n"); /*signed types*/ - printf("signed char min=%d\n",-(char)((unsigned char) ~0 >> 1)); + printf("signed char min=%d\n",-(char)((unsigned char) ~0 >> 1)-1); printf("signed char max=%d\n",(char)((unsigned char) ~0 >> 1)); - printf("signed int min=%d\n",-(int)((unsigned int) ~0 >> 1)); + printf("signed int min=%d\n",-(int)((unsigned int) ~0 >> 1)-1); printf("signed int max=%d\n",(int)((unsigned int) ~0 >> 1)); - printf("signed short min=%d\n",-(short)((unsigned short) ~0 >> 1)); + printf("signed short min=%d\n",-(short)((unsigned short) ~0 >> 1)-1); printf("signed short max=%d\n",(short)((unsigned short) ~0 >> 1)); - printf("signed long min=%ld\n",-(long)((unsigned long) ~0 >> 1)); + printf("signed long min=%ld\n",-(long)((unsigned long) ~0 >> 1)-1); printf("signed long max=%ld\n",(long)((unsigned long) ~0 >> 1)); /*unsigned types*/