PROGRAMMING LANGUAGE C
Handwritten notes of Programming language C
, Programming Language C
Content
Sr No Description Page No
1 Structure 4
2 Variable 4
3 Data Type 5
4 Operator 6
5 Exercise-1 9
6 Format specifier 10
7 Constant , Escape Sequence , Comments 10
8 Conditional Statements 11
9 Loops 14
10 Break and Continue Statement 16
11 Goto Statement 17
12 Typecasting 17
13 Functions 18
14 Exercise-2 20
15 Recursion 21
16 Exercise-3 22
17 Arrays 24
18 Exercise-4 26
19 Pointers 27
20 Arrays and Pointers Arithmetic 28
21 Exercise-5 30
22 Call by Value & Call by Reference 32
23 Exercise-6 34
24 Passing Array to a Function 35
25 Strings 37
26 Exercise-7 39
27 Structures 40
28 Typedef 41
29 Unions 42
30 Exercise-8 43
31 Static Variable 44
32 Exercise-9 45
33 Dynamic Memory Allocation 48
34 Exercise-10 52
35 Storage Classes 53
36 Exercise-11 55
2
, Programming Language C
Content-2
37 Pointer in Details 58
38 Exercise-12 62
39 Pre-processor 63
40 Exercise-13 66
41 Files 67
42 Command Line Arguments 71
43 Exercise-14 72
44 Function Pointer 73
45 Exercise-15 75
46 Memory Leak 76
3
, Programming Language C
Structure
1. Documentation section
2. Preprocessor section
3. Definition section
4. Global declaration
5. Main function
6. User defined functions
Variable
• Variable is a name given to the memory location.
• Declared by writing Type Variable_Name ;
• Initialized and declared by Type Variable_Name = Value ;
• EX : int a ; / float a, b, c; / etc.
Rules for defining a variable in C
- Can contain alphabet,digits and underscore(_).
- A variable name can start with alphabet and underscore only.
- It can’t start with number/digit.
- No whitespace and reserved keywords are allowed.
- Valid Names : int meet, int abc_xyz , int _a, int a4.
- Invalid Names : int 4a , int long , int &sra.
4