
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Octal literals in C
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
", a); printf("Decimal of 63(Octal) is %d
", b); }
Output
Decimal of 25(Octal) is 21 Decimal of 63(Octal) is 51
- Related Articles
- Define integer literals as octal values in Java
- Literals in C#
- Integer literals vs Floating point literals in C#
- Compound Literals in C
- User Defined Literals in C++
- What are literals in C++?
- Formatted string literals in C#
- What are Boolean Literals in C++?
- What are Character Literals in C++?
- What are string literals in C#?
- What are integer literals in C#?
- Character constants vs String literals in C#
- What are floating point literals in C#?
- What are string literals in C language?
- Type difference of character literals in C vs C++

Advertisements