Last active
July 2, 2025 13:19
-
-
Save Lokno/c30fcf94fd1392baf60c2099a2b18ba5 to your computer and use it in GitHub Desktop.
Demonstration of intentional overflow loop and infinite loop pitfall
This file contains hidden or 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
byte id = 25; | |
int temp; | |
Console.WriteLine($"Loop Start!"); | |
//for(byte i = (byte)(id+1); i <= byte.MaxValue; i++ ) // infinite loop | |
for(byte i = (byte)(id+1); i != id; i++ ) | |
{ | |
Console.WriteLine($"i: {i}"); | |
temp = i; | |
} | |
Console.WriteLine($"Loop Ended!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment