Home  >  Article  >  Backend Development  >  In C language, octal literal

In C language, octal literal

WBOY
WBOYforward
2023-09-09 21:37:021163browse

In C language, octal literal

In C/C++ we can use octal literals by typing zero before the actual number. For example, if the octal number is 25, then we must write 025.

Sample code

#include <stdio.h>
int main() {
   int a = 025;
   int b = 063;
   printf("Decimal of 25(Octal) is %d</p><p>", a);
   printf("Decimal of 63(Octal) is %d</p><p>", b);
}

Output

Decimal of 25(Octal) is 21
Decimal of 63(Octal) is 51

The above is the detailed content of In C language, octal literal. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete