In addition to binary, C language also uses octal.
The octal system is a base system of "every eight is advanced to one", which is described by eight symbols from 0 to 7. Again, the octal representation is described here through a comparison between decimal and octal.
The base of octal system is 8. During addition operation, eight is converted into one, and during subtraction operation, one is borrowed and converted into eight. For example, the numbers 0, 1, 5, 7, 14, 733, 67001, 25430 are all valid octal.
When octal is used to represent the decimal number 8, since the symbols representing octal are only 0~7, therefore, according to the rule of carrying eight to one, it is necessary to carry one bit to the high bit, which is expressed as 10. In the same way, when using octal to represent the decimal number 16, continue to carry one digit to the high bit and express it as 20.
Extended information
The source code for converting octal to decimal is as follows
#include
void main()< /p>
{
char *p,s[6];int n;
p=s;
printf("Please input a Octal number:");
gets(p);
n=0;
while(*(p)!='\0')< /p>
{
n=n*8+*p-'0';
p++;
}
printf("Octal number to Decimal number:%d",n);
}