::::::::::::::: c program :::::::::::::::
#include
That is because in C the leading 0 makes C tread the number as an octal an 0777 octal does indeed equal 511 decimal.
tread=treat and 511 should be 551
actually I do get 511 so I am guessing the 551 was a typo
You can test it with 0977 and you will get an error like ... error: invalid digit "9" in octal constant
when you put "0" before any number , compiler will take it as octal number. and dec number of 777 is 551 , so you are getting 551. btw what exactly do you want to do?
If you want to print octal value only then try following c program:- #include <stdio.h> void main() { int i=0777; printf("i=%o \n",i); }
Join our real-time social learning platform and learn together with your friends!