Constant:
A quantity that cannot be changed and carries a fix value is known as constant.
Types
● Numeric constant
● Character constant
● String constant
Numeric constants
Numeric constants consists of numbers.There are of two types namely integer and floating both of them are defined as follows;
Integer: Integer constant can represent negative and positive values (whole numbers. It takes two bytes in memory location.
Example: int roll No=52
Floating: Floating constant can represent any real numeric value that is both whole numbers and numbers that require digits after the decimal point. Usually four bytes are allocated for float variables.
Example: float price=52.04
Character constant
Character constant represent a single character, a letter, a digit or a punctuation mark enclosed in single quotation mark. Characters occupy one byte of memory.
Example: char grade=’A’
String constant
The term string is used in C to describe a contiguous sequence of characters enclosed in double quotation marks.In string constants whole sentence or word is written with in these double quotations.
Example: char name [] =”computer”
A quantity that cannot be changed and carries a fix value is known as constant.
Types
● Numeric constant
● Character constant
● String constant
Numeric constants
Numeric constants consists of numbers.There are of two types namely integer and floating both of them are defined as follows;
Integer: Integer constant can represent negative and positive values (whole numbers. It takes two bytes in memory location.
Example: int roll No=52
Floating: Floating constant can represent any real numeric value that is both whole numbers and numbers that require digits after the decimal point. Usually four bytes are allocated for float variables.
Example: float price=52.04
Character constant
Character constant represent a single character, a letter, a digit or a punctuation mark enclosed in single quotation mark. Characters occupy one byte of memory.
Example: char grade=’A’
String constant
The term string is used in C to describe a contiguous sequence of characters enclosed in double quotation marks.In string constants whole sentence or word is written with in these double quotations.
Example: char name [] =”computer”
its simpally an awsom effort
ReplyDeleteThanks
Delete