Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :