#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
unsigned int k;
k = 2;
i = -1;
if (k+i > 1 ) /* if i write ( (k+i) > 1) i get the same result */
{
printf("i converted to unsigned \n");
}
else
{
printf("i remains negative\n i: %d \n ", i );
}
return 0;
}
according to the integer promotion, the output should be a very high number. I'm confused, is it something that im missing? the output here is 1, but in the line where: if((k+i) > 1) "i" should be converted to unsigned. I have searched a lot but it seems that others get different results, im sure im using c.(visual code)