PROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS
IDENTIFIER:
An identifier is the name given to the variable, constant, type, function or label in the
program. Identifier is an important feature of all computer languages.
EXAMPLE:
In ‘int student Age’; ‘student Age’ is an identifier.
. Standard identifiers
. User-defined identifier
1-STANDARD IDENTIFIER:
A type of identifier that has special meaning in C is known as standard identifier. C
cannot use a standard identifier for its original purpose if it is redefined.
EXAMPLES:
PRINTF and SCANF are examples of standard identifiers. These are the names of input
\ output functions defined in standard input \ output library STDIO.H.
2-USER-DEFINED IDENTIFIER:
A type of identifiers that is defined by the programmer is known as user-defined
identifiers. The user-defined identifiers are used to store data and program results.
EXAMPLES:
Some examples of user-defined identifiers are a, marks and age etc.
CONSTANT:
A constant is a quantity that cannot be changed during program execution.
EXAMPLE:
# define Pi 3.1428
In above example, Pi is a constant; its value can’t be changed during program
execution.
TYPES OF CONSTANTS:
. Numeric constant
. Character constant
. String constant
NUMERIC CONSTANT:
Numeric constant consists of numbers. It can be further divided into two types:
. Integer constant:
Integer constant are numeric values without fraction or decimal point. Integer constants
represent that are counted. Both positive and negative integer constant are used in C
programs. The minus sign – is used for negative integer constants. If no sign is used,
the value is positive by default.
Examples:
Some examples of integer constants are as follow:
87 45 -10 -5
Examples:
Some examples of floating points constants are as a follow:
50.75 10.22 -13.42
CHARACTER CONSTANT:
Any character written within single quotation mark is known as character constant. All
alphabetic characters, digits and special symbols can be used as character constants.
The maximum length of a character constant is 1 character.
EXAMPLES:
Some examples of character constants are as follows:
‘A’ ‘-’ ‘9’ ‘=’ ‘$’
STRING CONSTANT:
A collection of characters written in double quotations mark is called string or string
constant. It may consist of any alphabetic characters, digits and special symbols.
EXAMPLES:
Some examples of string constants are as follows:
“Pakistan” “123” “99-Mall Road, Lahore”
THE END