Tuesday 23 April 2013

char c='\08';


What will be output if you will compile and execute the following c code?

#include "stdio.h"
#include "string.h"
void main(){
char c='\08';
printf("%d",c);
}



(A) 8

(B) ’8’

(C) 9

(D) null

(E) Compiler error


________________________________________
Explanation:
In c any character is starting with character ‘\’ represents octal number in character. As we know octal digits are: 0, 1, 2, 3, 4, 5, 6, and 7. So 8 is not an octal digit. Hence ‘\08’ is invalid octal character constant.

No comments:

Post a Comment