Javatpoint Logo
Javatpoint Logo

What Happens When We Exceed Valid Range of Built-in Data Types in C++

We all know that learning data types in C/C++ or any other programming language, for that matter, is essential. As keep using them all the time in our coding and career as software engineer journey.

Every data type will be associated with a specific size and memory, and when it exceeds its range, it turns out to be an infinite loop but will never reach the value it is supposed to be. Here we will see all the examples of char, int, bool etc.

C++ Code

Output:

 ‑ !"#$%&'()*+,-./0 1 2 3 4 5 6 7 8 9 : ; < = > ? @  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d

C++ Code

Output:

/tmp/7q8zRNkkRt.o
‑ !"#$%&'()*+,-./0123456789:;<=>? @ A B CD E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h I j k l m n o p q r s t u v w x y z { | } ~ �� � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � � � � � � �

C++ Code

Output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111............(infinite loop)

C++ Code

Output:

32767
-32768
-32767 ...............(infinite loop)

C++ Code

Output:

65532
65533
65534
65535
0
1
2
3
4...............(infinite loop)






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA