retagged by
234 views

1 Answer

4 votes
4 votes

Its because here even though i = -1, but on comparison with sizeof(i) (which returns a unsigned value ‘4’), the compiler also treats i as unsigned number.

And as i = -1, then converting it as unsigned will result in Large number as the MSB bit would be set as 1.

If i would have equal to non negative number less than 4, it would have entered into the loop.

The above code shows the unsigned value of i, when it is equal to -1
The above output shows the unsigned value of i, when it is equal to -1

 

edited by

Related questions

1 votes
1 votes
0 answers
3
amitarp818 asked Sep 23, 2023
244 views
I am unable to find any links to NPTEL assignments for any subject. Can anyone tell me how to find the list of the assignments?or give me the links to assignments…….....
0 votes
0 votes
1 answer
4
madvam asked Aug 20, 2023
324 views
2022 ECE Graduate here, worked for an year and laid off.Now I have started to prepare for gate from scratch(for CSE Paper).I know this is a mammoth of a task in short per...