Constants and Operators Flashcards
refer to fixed values that the program may not alter during its
execution
Constants
fixed values
Literals
Constants may belong to
any of the data type
basic data types
integer constant
floating-point constant
character constant or a string literal
enumeration constant (enum)
Two data types that must have at least one digit
Integer and Floating Point Constants
A data type that must not have a decimal point
Integer Constants
Two data types that can either be positive or negative
Integer and Floating Point Constants
No commas or blanks are allowed within __
Integer Constant and Real Constant
If no sign precedes an integer constant, then
it is assumed to be positive.
An integer constant is assumed to be positive if
no sign precedes an integer constant
The allowable range for integer constants is
-32768 to 32767
A data type that must have a decimal point
Floating Point Constants
You can represent floating point literals either
decimal form or
exponential form
A floating-point literal has
integer part
decimal point
fractional part
exponent part
A single alphabet, a single digit or a single special symbol enclosed within single quotes
Character Constants
The maximum length of a character constant is
1 character
Enclosed within double quotes
String Constants
Contains characters that are similar to character literals:
plain character
escape sequences
Two ways of defining constants
Using #define preprocessor
Using const keyword
Syntax of #define preprocessor
define IDENTIFIER value
Syntax of const keyword
const type variable = value;
Something that acts on a variable or an expression
Operators
Operators does
computes or retrieves a value
changes an object
The symbols which are used to perform logical and mathematical
operations in a C program
Operators
Join individual constants and variables to form expressions
Operators
Operators are used to perform _ and _ operations in a C program
logical and mathematical