
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
What is 0 (zero) - A decimal literal or An octal literal in C++
The 0 (Zero) before a number is basically the octal literal.
In C/C++ we can use octal literals by typing a zero before the actual number. For example, if an octal number is 25, then we have to write 025.
Example Code
#include <stdio.h> int main() { int a = 025; int b = 063; printf("Decimal of 25(Octal) is %d\n", a); printf("Decimal of 63(Octal) is %d\n", b); }
Output
Decimal of 25(Octal) is 21 Decimal of 63(Octal) is 51
- Related Articles
- What is a function literal in JavaScript?
- What is a string literal in C++?
- What is Java String literal?
- ASCII NUL, ASCII 0 (‘0’) and Numeric literal 0?
- JavaScript: How to Check if a String is a Literal or an Object?
- Is null a literal in Java?
- What is the difference between literal and constant in C++?
- What is the difference between literal and constant in C#?
- Hexadecimal integer literal in Java
- Raw string literal in C++
- Literal number suffixes in C#
- Raw string literal in C++ program
- How to write a short literal in C++?
- What is the difference between a String object and a String literal in Java?
- Using sed With a Literal String Instead of an Input File

Advertisements