What purpose does while(1);
serve ? I am aware while(1)
(no semicolon) loops infinitely and is similar to a spinlock situation. However I do not
while(1);
is actually very useful. Especially when it's a program that has some sort of passcode or so and you want to disable the use of the program for the user because, for an example, he entered the wrong passcode for 3 times. Using a while(1);
would stop the program's progress and nothing would happen until the program is rebooted, mostly for security reasons.