Skip to content
Related Articles

Related Articles

C | Data Types | Question 4
  • Difficulty Level : Medium
  • Last Updated : 24 Sep, 2020

Predict the output of following C program

#include <stdio.h>
int main()
    char a = 012;
    printf("%d", a);
    return 0;

(A) Compiler Error
(B) 12
(C) 10
(D) Empty

Answer: (C)

Explanation: The value ‘\012’ means the character with value 12 in octal, which is decimal 10.
Note: It is equivalent to char a = 012 and int a = ‘\012’ and int a = 012.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :