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

Constant, Variables and Other Definations

This document defines key concepts in C programming including character sets, keywords, identifiers, constants, and variables. It discusses the alphabets, digits, and special symbols that make up character sets. It lists the 32 keywords in C and notes rules around identifiers and variable names. It describes primary and secondary constants, and rules for integer, real, and character constants. Finally, it defines variables as memory locations that can store different data types and lists rules for variable names.
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)
79 views

Constant, Variables and Other Definations

This document defines key concepts in C programming including character sets, keywords, identifiers, constants, and variables. It discusses the alphabets, digits, and special symbols that make up character sets. It lists the 32 keywords in C and notes rules around identifiers and variable names. It describes primary and secondary constants, and rules for integer, real, and character constants. Finally, it defines variables as memory locations that can store different data types and lists rules for variable names.
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

CONSTANT, VARIABLES AND

OTHER DEFINATIONS
C CHARACTER SET
A Character denotes any alphabet, digit or special symbol used to represent
information.
Alphabets

A,BY,Z
a,by,z

Digits
Special symbol

0,1,2,3,4,5,6,7,8,9
!@#$%^&*()_+{}|:<>??/*-+

Token
KEYWORDS
Keywords are reserved words whose meaning is fixed by language and those are
known to the C compiler and computer means that keywords cannot be used as
variable names. There are only 32 keywords available in C which are :
Auto
Double
Int
struct
break

else

long

switch

case

enum

register

typedef

chair

extern

return

union

const

float

short

unsigned

continue

for

signed

void

default

goto

sizeof

volatile

do

if

static

while

It is important to know that compiler vendors (like Microsoft, Borland, etc)


provide their own keywords though it has been suggested by the ANDI
committee that every such compiler specific keyword should be preceded by two
underscores (as in __KEYWORD), not every vendor follows this rule.
IDENTIFIERS:

No special symbol other than an underscore (_) can be used in a variable name.
Int roll_number
CONSTANT:
TYPES OF C Constants:
C constants can be divided into two major categories:
1. Primary Constants.
2. Secondary Constants.
Rules for Constructing Integer Constants
1.
2.
3.
4.
5.
6.
7.

An integer constant must have at least one digit.


It must not have a decimal point.
It can be either positive or negative.
If no sign precedes an integer constant, it is assumed to be positive.
No commas or blanks are allowed within an integer constant.
The allowable range for integer constants is -32768 to 32767.
Range of an integer constant depends upon the compiler.

REAL CONSTANTS:
Real constants are known as Floating point constants. The real constants may be
in two formsFractional form and Exponential form .
Rules;
1.
2.
3.
4.
5.

A real constant must have at least one digit.


It must have a decimal point.
It could be either positive or negative.
Default sign positive.
No commas or blanks are allowed wir=thin a real constant.

In exponential form of representation, The real constant is represented in two


parts. The part appearing before e is called mantissa, Whereas the part
following e is called exponent.
Following rules must be observed while constructing real constants expressed in
exponential form:
1. The mantissa part and the exponential part should be separated by a
letter e.
2. The mantissa part may have a positive or negative sign.
3. Default sign of mantissa part is positive.
4. The exponent must have at least one digit, which must be a positive or
negative integer . Default sign is positive.
5. Range of real constants expressed in exponential form is -3.4e38 to
3.4e38.

RULES FOR CONTRUCTING CHARACTER CONSTANTS


1. Character content is a single alphabet, a single digit or a single special
symbol enclosed within single inverted commas.
2. The maximum length of a character constant can be one character.
VARIABLES:
Variable is an entity that may vary during programme. Variable names are names
given to locations in memory. These locations can contain integer, real or
character constants. In any programme we typically do lots of calculations. The
result of these calculations is stored in computers memory. Like human memory
computer memory also consists of millions of cells. The calculated values are
stored in these memory cells. To make the retrieval and usage of these values
easy this memory cells (also called memory locations) are given names since the
value stored in each locations may change the names given to this locations are
called variable names.
Variable: Variables are means for location in memory used by programme to
store data. To identify the variables, variable name must be unique to every
single variable.
Variable names may consist of letters, digits and the underscore (_) character
subject to the following conditions:
1. They must begin with a letter .Some systems permit underscore as the
first character.
2. It should not be a keyword.
3. White space is not allowed.
4. Upper case and lower case are significant that is , the variable Total is not
the same as total or TOTAL.
5. ANSI standard recognises a length of 31 characters. However, length
should not be normally more than 8 characters, since only the first eight
characters are treated as significant by many compilers.
Some examples of valid variable names are :
John

Value

Delhi

ph_values

Sum1

distance

T_raise
mark

You might also like