C | Data Types | Question 4

Predict the output of following C program

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


(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

Improved By : shaztri



Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.