✅ Lecture 1: Introduction to Programming
Key Points:
● Programming is creating a precise sequence of instructions to solve a problem.
● It's about planning, organizing, and paying attention to detail.
● Importance:
○ Builds analytical and problem-solving skills.
○ Teaches critical thinking, creativity, and logic.
● Skills Required:
○ Attention to detail
○ Code reusability
○ User-friendly design
○ Commenting the code
○ Understanding computers follow exact instructions (they’re not intelligent)
Program Design Recipe:
1. Analyze the problem
2. Break into small parts with examples
3. Write pseudo code or flowcharts
4. Implement using programming language
5. Test, revise, and improve
✅ Lecture 2: Software Categories & C Language
Software Categories:
1. System Software:
○ OS (Windows, Linux)
○ Device Drivers
○ Utilities (e.g., disk defragmentation)
2. Application Software:
○ Programs used by end users (e.g., MS Word, Excel)
C Language History:
● Originated from B and BCPL in the 1970s (Bell Labs).
● Developed by Dennis Ritchie.
● Popular for system programming (e.g., UNIX OS).
● Standardized by ANSI and ISO.
Tools in Programming:
● Editor: Write code (e.g., Notepad++, Code::Blocks)
● Compiler: Converts C code to machine language
● Interpreter: Executes line by line
● Debugger: Helps find and fix logical errors
● Linker: Combines all necessary code parts
● Loader: Loads the executable into memory
✅ Lecture 3: First C Program & Basic Concepts
Sample Program:
cpp
CopyEdit
#include <iostream.h>
main() {
cout << "Welcome to Virtual University of Pakistan";
}
Concepts Introduced:
● #include: Preprocessor directive to include libraries.
● main(): Starting point of program execution.
● cout <<: Used to print output.
● ; (semicolon): Marks end of each statement.
Variables:
● Placeholders in memory with:
○ Name
○ Type
○ Value
● Must be declared before use.
Data Types:
● int: Whole numbers
● short: Small integers
● long: Large integers
● float: Decimal numbers (e.g., 3.14)
● double: Bigger decimals (more precision)
● char: Single character (e.g., 'a')
Assignment Operator (=):
● x = 5; → Assigns value 5 to variable x
Arithmetic Operators:
Operation Symbol Example (C Code)
Addition + x + y
Subtraction - x - y
Multiplication * x * y
Division / x / y
Modulus % x % y (remainder)
Operator Precedence:
● Parentheses ( ) first
● Multiplication *, Division /, Modulus %
● Addition +, Subtraction -
🎯 Lecture 1
● Definition:
"A program is a precise sequence of steps to solve a particular problem.”
● Alan Perlis (on education):
"It goes against the grain of modern education to teach children to program. What fun is
there in making plans, acquiring discipline in organizing thoughts, devoting attention to
detail and learning to be self-critical?"
● Steve Summit (on programming basics):
"At its most basic level, programming a computer simply means telling it what to do..."
● Matthias Felleisen (on programming's importance):
"The answer consists of two parts. First, it is indeed true that traditional forms of
programming are useful for just a few people. But, programming as we the authors
understand it is useful for everyone..."
● Critical skills programming builds:
○ “Critical reading”
○ “Analytical thinking”
○ “Creative synthesis”
● Programming practices to remember:
○ “Paying attention to detail”
○ “Think about the reusability.”
○ “Think about user interface”
○ “Understand the fact the computers are stupid”
○ “Comment the code liberally”
● Program design recipe (by analogy to soccer):
“Learning to design programs is like learning to play soccer. A player must learn to trap
a ball, to dribble with a ball, to pass, and to shoot a ball...”
🎯 Lecture 2
● Software categories:
○ “System Software”
○ “Application Software”
● Definition of operating system:
“Operating system is the software responsible for controlling the allocation and usage of
hardware resources such as memory, central processing unit (CPU) time, disk space,
and peripheral devices.”
● Device drivers description:
"When we attach a new device with the computer, we need software to communicate
with this device. These kinds of software are known as device drivers..."
● Utility software (example):
“Whenever you write a file and save it to the disk, Compression Utility compresses the
file (reduce the file size) and write it to the disk…”
● C language origin & history:
“Dennis Ritchie developed a general purpose language, called C language, by using
different features of BCPL and B languages.”
● On standardization:
“In 1983 a technical committee was created ... to provide an unambiguous and
machine-independent definition of the language. In 1989 the standard was approved.”
● Tools of the trade:
○ “Editors”
○ “Compiler and Interpreter”
○ “Debugger”
○ “Linker”
○ “Loader”
🎯 Lecture 3
● First program line:
# include <iostream.h>
● About main():
“main is actually the one which is run when your program is used.”
● On semicolons:
“There is a semicolon (;) at the end of the above statement. This is very important.”
● Variables description:
“Variables are locations in memory for storing data.”
● On assignment operator:
“In C language equal-to-sign (=) is used as assignment operator. Do not confuse the
assignment (=) in algebra.”
● Data types listed:
○ “int”
○ “short”
○ “long”
○ “float”
○ “double”
○ “char”
● Arithmetic operators table excerpt:
“Operator” | “C expression”
“Modulus %” | “x % y”
● Operator precedence rules:
“In an expression, the parentheses ( ) are used to force the evaluation order.