As the title suggests, I wonder how it works unsigned int(or things like NSUInteger, u_int_blahbut I guess it's all typedefthe same thing). For example, when their value falls below zero, does an increase occur? Has an error occurred? One specific example of this will indirectly set a value to a negative number.
for (unsigned int x = 5; x > -10; x--) {
}
In addition, another way to indirectly establish this would be for the user to enter it.
printf("Enter a number");
unsigned int x;
scanf("%ud", &x);
So, I have three questions. That stops and unsigned int from assigning to a negative number ( unsigned int x = - 3). How this behavior is implemented (by the compiler or in other ways). What happens when an unsigned int is assigned (directly or indirectly) to a negative value. Is the data corrupted? Is this an overflow?
Thankyou
source
share