C Control StatementsC FunctionsC ArrayC PointerC Dynamic MemoryC StringC MathC StructureC UnionC File HandlingC PreprocessorC Command LineC Misc |
Constant in cNumeric Constant in CThe Numeric constant consist of numerical digits. They may be without decimal point or may have decimal point(.). These are number of rules for defining numeric constants- 1. Numeric constant should have at least one digit. Integers Constant in CThere are three types of integer constant based on numbers systems such (decimal, octal, hexadecimal) so here all are integer constants or integer types constants but based on number system Decimal constants- 0,1,2,3,4,5,6,7,8,9 (base 10) lets us see some valid decimal integers constants are-
here are some invalid decimal integers constants are in the below example-
let us see some valid octal integers constants and take example, first digit must be 0.
let us see and take example of some valid Hexadecimal integers constant, first two characters should be 0X or 0x. some examples are
Real(Floating point) Constant in CThe Floating point constant are numeric number constant with decimal point. Here take example of some floating point constants –
Character Constant in CThe character constant is the single character that is enclosed with in the single quotes. here are some valid character constants are-
Note: Every character has unique integer value. so every associated value or integer value is machine code such as ASCII(American standard code for information interchange). its depend on machine if machine using ASCII then A character represent by 65 Here are Some ASCII values are-
String Constant in CA string Constant is a group of characters enclosed within double quotes(“”). At the end of string the complier automatically placed null character (‘\0’). Here are some examples of String constants-
Symbolic Constant in Cif in program we want to use constant as several times, we can given it a name. such as if we use 3.1414587 at many times in a program. We can give it a name PI, and uses it name PI . where we need instead of writing the constant value anywhere. These types of constant are known as Symbolic constant.
|