Notes 2
Notes 2
C Programming is widely used in Computer Technology, We can say that C is inspiration for
development of other languages. We can use C for different purposes.
Below are some of the Features of C Programming –
1 . Structured Language
2. Block Structured
3. Procedural
4. Follows Top Down Approach
5 . Powerful :
Provides Wide verity of ‘Data Types‘
Provides Wide verity of ‘Functions’
Provides useful Control & Loop Control Statements
6 . Bit Manipulation
C Programs can be manipulated using bits. We can perform different operations at bit level.
We can manage memry representation at bit level. [Eg. We can use Structure to manage
Memory at Bit Level. It provides wide verity of bit manipulation Operators. We have
bitwise operators to manage Data at bit level.
7 . Modular Programming:
Modular programming is a software design technique that increases the extent to which
software is composed of separate parts, called modules. C Program Consist of Different
Modules that are integrated together to form complete program
8 . Efficient Use of Pointers:
Pointers has direct access to memory. C Supports efficient use of pointer .
9 . More Efficient & Fast
During execution it gives output in a correct and timely way.
Structured programming
Structured programming, sometimes known as modular programming.
In Struct. Prog., control is passed downward through the structure without unconditional
branches to higher levels of the structure.
A defined function or set of similar functions is coded in a separate module or sub module,
which means that the code can be loaded in to memory more efficiently and that
modules can be reused in other programs.
Token Example :
1 Keyword do while
2 Constants -76 89
5 Special Symbol * @
6 Operators ++ /
IDENTIFIERS
An identifier refers to the name of the object. The syntactic rules to write an identifier
name in C are:
• Can have letters , digits or underscores.
• First character must be a letter or an underscore but can’t be a digit.
• No special character except underscore can be used.
• Keywords or reserved words cannot form a valid identifier name.
• Maximum number of characters that form an identifier name is compiler dependent.
C Keywords
C keywords are the words that convey a special meaning to the c compiler. The keywords
cannot be used as variable names because by doing so, we are trying to assign a new
meaning to the keyword which is not allowed. There are total 32 keywords defined in C
Volatile While
declaration statement
• Every identifier (except label name) needs to be declared before it is used.
• An identifier can be declared by making use of declaration statement.
ROLE: To introduce the name of an identifier along with its data type (or just type) to
the compiler before its use.
• The general form of declaration statement is:
→[storage_class_specifier ][type_qualifier|type_modifier ]type identifier [=value,
identifier [, ...]];
• The terms enclosed within [] (i.e. square brackets) are optional and might not be
present in a declaration statement. The type name and identifier name are
mandatory parts of a declaration statement.
Examples of valid declaration in C:
• int variable; (type int and identifier name variable present)
• static int variable; (Storage class specifier static, type int and identifier
name variable present)
• int a=20, b=10; (type int, identifier name a and its initial value 20 present,
another identifier name b and its initial value 10 present )
2. Can only be used to declare 2. It can be used to declare identifiers of different types
identifiers of the same type. e.g. int a=10;float b=2.3; are valid statements.
e.g. int a=10, float b=2.3; is an
invalid statement.
Type-Modifiers:
It changes the base-type to get a new type=> range & Arithmetic props are modified.
Corresponding keywords available in C are:
1. signed
2. unsigned
3. short
4. long
Type-Qualifiers: They are used to indicate special properties of data within an object
(variable).
Two qualifiers are defined:
1.Constant (const int i=10;)
2. Volatile: The volatile keyword is intended to prevent the compiler from applying any
optimizations on objects that can change in ways that cannot be determined by the
compiler.
Data-Types Description: