C | Data Types | Question 4
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
Please Login to comment...