I just tried to lower a unsigned int below 0. To my surprise it works!
#include<stdio.h>
int main(void)
{
unsigned int foo = 5;
foo -= 10;
printf("%d", foo);
return 0;
}
Compiled with
clang -Weverything main.c
This program returnes
-5
As this post and my personal knowledge states, it's not possible. But why does it work then? Am i missing something? Is it because of Undefined Behavior? Or is it printf? Or something else?