When we initialize a value by putting ‘0’ before a number, the number is treated as octal. For instance ’10’ is read as 10 but ‘010’ is read as 8.
Input : 0101 Output : 65 Input : 01010 Output : 520
Compiler Error : 9 is not a valid digit in octal number.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Compound Literals in C
- Types of Literals in C/C++ with Examples
- Octal numbers in c
- Program to Convert Hexadecimal to Octal
- Advantages and Disadvantages of Array in C
- Merge two sorted arrays in O(1) extra space using Heap
- Hamming code Implementation in C/C++
- Can we write a print statement within if parentheses?
- Draw an ellipse divided by straight line into two colored part in C++ Graphics
- Types of C files after its compilation
- What happens if we mix new and free in C++?
- Food Ordering System in C
- Difference between sizeof(int *) and sizeof(int) in C/C++
- Runtime and Compile-time constants in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.