TCS
Company
Programming
Output
What is the output of the following program?
#include
int main(){
int c=08;
printf("%d",c);
return 0;
}
Read Solution (Total 3)
-
- Error...
including the prefix "0" before a number represents an octal number...
But octal number should start from 010...
Decimal nd octal representation of 1st 10 integers
1 - 1
2 - 2
3 - 3
4 - 4
5 - 5
6 - 6
7 - 7
8 - 010 [divide 8 by 8...quotient - 1,remainder-0,combine them-10,prefix - 0]
9 - 011
10 -012
- 10 years agoHelpfull: Yes(14) No(0)
- error....
because of illegal declaration of octal digit which can be (0-7)after first 0.
for ex
07,06...... are valid but not 08.
- 10 years agoHelpfull: Yes(0) No(0)
- invalid digit "8" in octal constant
- 8 years agoHelpfull: Yes(0) No(0)
TCS Other Question