If a Decimal constant declared with fractions, then the compiler will take only the integer part of the value and it will ignore its fractional part. This is called as “Implicit Conversion”. It will be discussed later. (ii) Octal Any sequence of one or more octal values ( ….
) that begins with is considered as an Octal constant. Chapter Page - - Valid Invalid , (Commas is not allowed) - . (Decimal point is not allowed)** + ( is not a permissible digit in octal system) Notes ** When you use a fractional number that begins with , C++ considers the number as an integer not an Octal. (iii) Hexadecimal Any sequence of one or more Hexadecimal values ( ….
, A …. F) that starts with 0x or 0Xis considered as an Hexadecimal constant. Valid Invalid 0x123 0x1,A5 (Commas is not allowed) 0X568 0x.14E (Decimal point is not allowed like this) The suffix L or l and U or u added with any constant forces it to be represented as a long or unsigned constant respectively. ( ) Real Constants (or) Floating point constants A real or floating point constant is a numeric constant having a fractional component.
These constants may be written in fractional form or in exponent form. Fractional form of a real constant is a signed or unsigned sequence of digits including a decimal point between the digits. It must have at least one digit before and after a decimal point. It may be prefixed with + or - sign.
A real constant without any sign will be considered as positive. Exponent form of real constants consists of two parts: ( ) Mantissa and ( ) Exponent. The mantissa must be either an integer or a real constant. The mantissa followed by a letter E or e and the exponent, should also be an integer.
For example, 58000000. may be written as . × or .58E8. Mantissa (Before E) Exponent (After E) .