Home » C Programming » Data Types » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int num[4] = {11, 12, 13, 14, 15};
    int k;
    for (k = 0; k < 4; k++)
    if ((char)num[k] == '14')
    {
    printf("%d\n", num[k]);
    }
    else
    {
    printf("False\n");
    }
    }
    1. 14
    2. 15
    3. False
      False
      False
      False
    4. False
      False
    5. None of these
Correct Option: C

The char type-casted integral value 14 is 14 only.



Your comments will be displayed only after manual approval.