Programming
1. Monolithic Programming
i. Flat physical structure
ii. Global data and sequential code
iii. Jumps are allowed
iv. No structures are allowed
Ex: Assembly language, BASIC
2. Procedural Programming
i. Subroutines are allowed
ii. Data all are global
iii. Jumps and calls are included
Ex: FORTRAN and COBOL
3. Structural Programming
i. Data security is less
ii. Data all are not global (It is based on it's declaration)
iii. Parameter passing
iv. Controlled scope of data
v. User defined data type
vi. Modular programming
Ex: Pascal and 'C'
4. Object Oriented Programming
This concept is obtained through data abstraction. The main building block in OOP (Object Oriented Program) is object. Objects can describe anything in worlds.
There are 2 categories:
i. Object Based Programming Language: (ADA)
ii. Object Oriented Programming
Features of C Language
1. C is a middle level language, easy to use
2. C is reliable & portable across different environments
3. C is a system programming language
4. C is a structured programming language
5. C is a free form language.
6. C is case sensitive
7. C supports DMA (Dynamic Memory Allocation)
8. C allows us to work with memory of system
Tokens
Keyword
This word is having some Special Meaning. (i.e.) for this word already some program build by the author.
Ex for, while, if, int…
Data-type
Which type of data we are giving that is data type. There are two types :
1. Numeric Data type
i. Integer
ii. Floating point
2. Character Data Type
i. Character
ii. String
Table for Data type details
Target | Data-Type | C/S | Bytes | Range |
Whole number | Int | %d | 2 Bytes | -32768to 32767 |
Floating Point | Float | %f | 4 Bytes | 3.4E-38to3.4E+38 |
Character | Char | %c | 1 Byte | -128 to 127 and 0 to 255 |
String | Char-Array | %s | User-Define | User-Defined |
Variables or Identifiers:
Variables means Named Memory Location (NML)
Rules for Naming Variables:
i. Variable name should be started with Alphabet or Underscore
ii. Variable name should contain with in 32 characters.
iii. Variable name should not be in keyword.
iv. Variable name should have the following range...
Ex : A - Z, a - z, 0 -9,
Declaring Variables:
[ Storage-Class] <Data-type> Variable1,Variable2,...;
Ex: int a, b, c; a=12 > Integer Variable
Char ch, dh; ch='i' > Character Variable
float jk, kl; jk=12.34 > Floating Point Variable
Constants
The Contants means nothing but, During Program Execution the Variables Value won't change.By using <const> Key word we can able to mention the variables as a constant variables. If you need to modify the value of the constant variable during program execution time by using pointer we can able to perform that operation.
Syntax
<const> variable = <Value>;
or
<const> <Data-Type> Variable-Name = <Value>;
Ex: const a = 12;
const float b = 12.45;
The Constants is classified into Two types:
i. Numeric Constants
ii. Character Constants
Operators
Operators are used to perform a specified operation. If you perform a operation then you need operand. Operand means nothing but it is a variable or values.
The Operators classified into following types:
1. Arithmetic operator. - +, -, *, /, %
2. Logical Operators - &&, ||, !
3. Relational Operators - >, <, >=, <=, ==, !=
4. Increment/Decrement Operators - ++, --
5. Pointer operators - *, &, ->
6. Assignment Operators - =
7. Ternary Operators - ? : ;
Expressions
The Expressions means nothing but, the combination of operands and Operators are called expressions.
That is classified into the following types..
i. Arithmetic Expressions > (A + b)
ii. Relational Expressions > (a > b)
iii. Logical Expression > (A && b)
Escape Sequences (Executable Characters)
These characters are having some special meaning. (i.e.) Whenever the interpreter will see this characters at that time it execute that characters.
'\ 0' --> NULL Character
'\a' --> alert sound (beep sound)
'\t' --> Tab action n
'\n' --> New line
'\f' --> Form feed
'\r' --> Carriage Return