Which of the following is correct about the following loop in C?
1 2 3 4 5 6 7 8 |
|
char
is guaranteed to be of 8 bits.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Notice that
char
can essentially store information upto a byte. The loop works fine untili == 255
. But beyond that when it is incremented, it rolls back toi = 0
.Since
i
always satisfiesi < 256
, the loop is infinite.I recommend the reader to verify this by running the code.