A constant can be defined as a quantity that does not change. There are 3 different types of constants. Integer, floating point and character constants.
Integer constant is an integer quantity containing sequence of digits. It has no decimal point. It can be either positive or negative. Blanks and commas are not allowed within integer constants. The value ofthe constant must lie within the range of integer values. A decimal integer constant can consist of any combination of digits taken from 0 through 9.
E.g. 0 5280 9999
An octal integer constant can consist of any combination of digits from 0 through 7. The first digit must be 0.
E.g. 0 01 0743
A hexadecimal integer constant must begin with 0x or 0x, followed by any combination of digit from 0 through 9 and a through f.
E.g. 0x1 oxab7f
Certain suffixes can be given to constants, which identify them for the type
5000U unsigned (decimal)
0x5000U unsigned (hex)
1234UL unsigned long (decimal)
0777U unsigned (octal)
Floating Point Constants
Floating point constant contains a decimal point or an exponent. It could be either negative or positive. No commas or blanks are allowed within a real constant
E.g. +3.2e-5, -0.2e-5, -32.76
A character constant is a character enclosed in single quotation marks. A character constant can contain only one character.
E.g. ‘A’ ‘3’ ‘$’
Each character has a corresponding ASCII value (which is the numeric value of character in machine’s character set.) as given below.
C Related Interview Questions
|DBMS Interview Questions||C++ Interview Questions|
|C & Data Structures Interview Questions||Java Interview Questions|
|Go (programming language) Interview Questions||F Sharp (programming language) Interview Questions|
|C preprocessor Interview Questions||R Programming language Interview Questions|
|D Programming Language Interview Questions||Lua (programming language) Interview Questions|
|Embedded C Interview Questions|
Introduction To C-programming
Data Types And Storage Classes
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.