#include <stdio.h>
int main()
{
int i = 23;
char c = -23;
if (i < c)
printf("Yes\n");
else
printf("No\n");
}
This segment of code executes the else block, but it executes the if block if we replace integer value with unsigned int i = 23.
Printing these values with %x
results in
- c=ffffffe9
- i=17
My question here is how unsigned ints and char variables gets stored in memory?