Single Choice Not Set

Q What is the output of this C code?

#include <stdio.h>
    int main()
    {
        int var = 010;
        printf("%d", var);
    }

ID: #1362 Constant in C Language 3,058 views
Question Info
#1362Q ID
Not SetDifficulty
Constant in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 2
  • B 8
  • C 9
  • D 10
Correct Answer

Explanation

Answer:b
010 is octal representation of 8.
Output:
$ cc pgm4.c
$ a.out
8

Share This Question

Challenge a friend or share with your study group.