Basic Programming Skills/ Foundations of Computer Programming DCAP102/DCAP401 Editor Dr. Anil Sharma
www.lpude.in
DIRECTORATE OF DISTANCE EDUCATION
BASIC PROGRAMMING SKILLS/ FOUNDATIONS OF COMPUTER PROGRAMMING Edited By Dr. Anil Sharma ISBN: 978-93-87034-75-4 Printed by EXCEL BOOKS PRIVATE LIMITED Regd. Office: E-77, South Ext. Part-I, Delhi-110049 Corporate Office: 1E/14, Jhandewalan Extension, New Delhi-110055 +91-8800697053, +91-011-47520129
[email protected]/[email protected] [email protected] www.excelbooks.com
for Lovely Professional University Phagwara CONTENTS
Unit 1: Foundation of Programming Languages 1 Manmohan Sharma, Lovely Professional University Unit 2: Introduction to C Language 19 Kumar Vishal, Lovely Professional University Unit 3: Basics - The C Declaration 36 Anil Sharma, Lovely Professional University Unit 4: Operators 48 Yadwinder Singh, Lovely Professional University Unit 5: Managing Input and Output in C 61 Anuj Sharma, Lovely Professional University Unit 6: Decision-making and Branching 91 Balraj Kumar, Lovely Professional University Unit 7: Decision-making and Looping 126 Mandeep Kaur, Lovely Professional University Unit 8: Arrays 155 Kanika Sharma, Lovely Professional University Unit 9: Strings 168 Sarabjit Kumar, Lovely Professional University Unit 10: Pointers 187 Anil Sharma, Lovely Professional University Unit 11: Functions 209 Anil Sharma, Lovely Professional University Unit 12: Union and Structure 237 Sarabjit Kumar, Lovely Professional University Unit 13: File Handling in C 266 Anil Sharma, Lovely Professional University Unit 14: Additional in C 282 Avinash Bhagat, Lovely Professional University
SYLLABUS Basic Programming Skills/Foundations of Computer Programming
Objectives: It imparts programming skills to students. Students will be able to:
Understand the structure of a C/C++ language program including the use of variable definitions, data types, functions, scope and operators.
Be able to develop, code, and test well structured programs using: if-then logic, while, do, and for loops, functions, arrays, strings and string functions
Sr. No. Description 1. Introduction: ANSI C standard, Overview of Compiler and Interpreters, Structure of C Program, Programming rules, Execution 2. Basics – The C Declarations: C Character Set, keywords, : Identifiers, data types, operators, constants and variables Operators & Expressions 3. Input/ Output in C: Formatting input & output functions. 4. Decision-making Statements: if, else if Control Statements: For, do while, while. Control transfer statements - break, continue. 5. Arrays and Strings: Defining arrays; I/O of arrays, I/O of string data; built-in library functions to manipulate strings, array of strings 6. Pointer: Introductions, Features, Declaration, Pointers and Arrays, pointers to pointers ,Pointers and strings, Void Pointers 7. Functions: Defining and accessing a functions, passing arguments – call by value, function prototypes, recursive functions Storage Classes: Storage classes and their usage 8. Structures & Unions: Defining and processing structures, array of structures, nested structures, Unions & difference from Structures 9. Files: Opening, reading, writing & Closing file 10. Additional in C: Dynamic memory allocation, Memory models, Linked List
Manmohan Sharma, Lovely Professional University Unit 1: Foundation of Programming Languages
Unit 1: Foundation of Programming Languages Notes
CONTENTS Objectives Introduction 1.1 Programming Language 1.2 Assembly Language 1.3 Assembly Program Execution 1.4 Assembler 1.5 Assembly Program and its Components 1.6 Machine Level Language 1.7 Higher Level Languages 1.8 Compiling High Level Language 1.9 Some High Level Languages 1.10 Summary 1.11 Keywords 1.12 Self Assessment 1.13 Review Questions 1.14 Further Readings
Objectives
After studying this unit, you will be able to: