0% found this document useful (0 votes)
4 views

PROGRAMMING FUNDAMENTALS

Uploaded by

aslamsaira437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

PROGRAMMING FUNDAMENTALS

Uploaded by

aslamsaira437
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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.

RULES FOR IDENTIFIERS:


. The first character must be an alphabet or underscore (-).
. The identifier name must consist of only alphabetic characters, digits or underscore.
. The reversed word cannot be used as identifier name.
TYPES OF IDENTIFIERS:
There are two types of identifiers in C language:

. 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

. Floating point constant:


Floating point constants are numeric values with fraction or decimal point. Floating point
constants represent values that are measured. Both positive and negative floating
points constants are used in C programs. The minus sign – is used for negative floating
points constants are used in C programs. If no sign is used, the value is positive by
default.

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

You might also like