-
How many times the while loop in the following program will get executed if a short int is 2 byte wide?
#include <stdio.h>
int main ( )
{
int a = 1;
while (a <= 255)
{
printf ("%c %d \n", a, a);
a++;
}
return 0;
}
-
- Infinite times
- 255 times
- 256 times
- Only once
- 254 times
Correct Option: B
The while(a <= 255) loop will get executed 255 times. The size short int(2 byte wide) does not affect the while() loop.