Home » C Programming » Loops » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    short k;
    for (k = 1; k >= 0; k++)
    printf("%d\n", k);

    }
    1. Numbers will be displayed until the signed limit of short and throw a runtime error
    2. This program will get into an infinite loop and keep printing numbers with no errors
    3. The control won’t fall into the for loop
    4. Numbers will be displayed until the signed limit of short and program will successfully terminate
    5. None of these
Correct Option: D

Numbers will be displayed until the signed limit of short and program will successfully terminate



Your comments will be displayed only after manual approval.