Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C code?
#include < stdio.h >
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf(“%d\n”, i);
}

What will be the output of the following C code?
#include < stdio.h >
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf(“%d\n”, i);
}
a) The control won’t fall into the for loop
b) Numbers will be displayed until the signed limit of short and throw a runtime error
c) Numbers will be displayed until the signed limit of short and program will successfully terminate
d) This program will get into an infinite loop and keep printing numbers with no errors

Answer: c

Join The Discussion