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
- Difference between int (*p) and int* p?
- 3-way comparison operator (Space Ship Operator) in C++ 20
- Sorting strings from the text file
- How to generate a vector with random values in C++?
- Brief Overview & Comparison of Object-Oriented Programming from C to Java
- Relational Database from CSV Files in C
- Difference between std::set vs std::vector in C++ STL
- Vector of Maps in C++ with Examples
- Data Conversion in C++
- Bug Tracking System
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.