0% found this document useful (0 votes)
20 views

Week1 Lec1 Syllabus Introduction Ch1 Fa24

Uploaded by

suhokim317
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Week1 Lec1 Syllabus Introduction Ch1 Fa24

Uploaded by

suhokim317
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

CSC1103: Fundamentals of Programming [ C ]

Lecture 1

Fall 2024
Sheikh Usama Khalid
Department of Computer Science
100 Building, Clifton, Room 301
[email protected]
Lecture Plan

• Introduction
Fundamentals of Programming

• Course Syllabus

• Sample C Program

• Chapter 1: Introducing C
Introduction
• Introduce yourself.
Fundamentals of Programming
Course Overview
• Course
• Class Timings
Fundamentals of Programming

• Course Material
• Marks Instruments
• Grading
• Attendance
• What to Avoid
• Keys to Success
• Syllabus / Topics
Course Credit Hours
• Fundamentals of Programming: 4 Credit Hours Course
– Theory: 3 Credit Hours ( 1 Classes / Week )
Fundamentals of Programming

– Instructor: Sheikh Usama Khalid

– Practical: 1 Credit Hour (1 Labs / Week )


– Instructor: Qamber Ali | Zaid Ali

5
Class Timings [ To Review ]
Section Day Time Room / Lab
E Wednesday 11:30 - 02:45 100 Building, ----
Fundamentals of Programming

F Thursday 01:30 - 04:00 100 Building, Lab 05


G Thursday 04:00 - 06:30 100 Building, Lab 05
H Monday 11:30 - 02:45 100 Building, CS Lab

6
Course Objectives
• Course Objective:
– Learning about problem solving skills
Fundamentals of Programming

– Learn logic building


– Writing pseudo code
– Getting familiarized with basic building blocks and programming constructs of PL.
– Enabling Students to develop analytical skills and solve practical programming problems.

• Teaching and Learning Methodology:


– Lectures
– Live Code Demonstration
– Writing Pseudo Code
– Readings and Assessments
– Class Discussion and Student Participation

7
Course Material
• Google Class Room:
• Section E: https://classroom.google.com/c/NzEyNTI3ODc0MDA3?cjc=zswyvod
Fundamentals of Programming

• Section F: https://classroom.google.com/c/NzEyNzM4MjY5NTQ3?cjc=33iq6e3
• Section G: https://classroom.google.com/c/NzEyNzQyMTkxOTI3?cjc=rwqdj5a
• Section H: https://classroom.google.com/c/NzEyNzQ1NDgzODcy?cjc=psknlci
• Questions/Discussions:
Mondays Wednesdays
Counseling
Hours 03:00 - 6:00 03:00 - 6:00

– Preferably on email: [email protected]


– Room 301
– OR by appointment through email

8
Marking Heads
• Exams(2)
• Midterm - 8th week
• Final - 16th week
Fundamentals of Programming

• Project(1)
• Proposal Submission - 10th week
• Project Demonstration and Evaluation - 15th week
• Quizzes(1/2)
• Before Midterm - 6th week
• Before Final - 14th week
• OR to be announced in class as and when required
• Assignments(1/2)
• Before Midterm - 6th week
• Before Final - 14th week
• OR to be announced in class as and when required
• These may become part of midterm / final exam as well.

9
Marks Instruments
• Project
• 2 or 3 students per group
Fundamentals of Programming

• Details would be shared after midterm exam.

10
Grading
Marks
Marks Head Total Frequency Total Marks / Head
/ Frequency
Midterm Exam 1 20 20
Fundamentals of Programming

Final Exam 1 40 40
Quizzes 1 10 10
Assignments 1 10 10
Project
1 20 20
Class Participation Bonus Marks
100

11
Books
• Text Book:
• C Programming: A Modern Approach by K. N. King
2nd Edition, W. W. Norton & Company, 2008.
• Reference Books:
Fundamentals of Programming

• Effective C: An Introduction to Professional C Programming, Robert C. Seacord, No Starch


Press ,2020
• Learn C Programming: A beginners guide to learning C programming the easy and disciplined way,
Jeff Szuhay, 1st Edition, Packt Publishing,2020
• Programming in C, Stephen G. Kochan , 4th Edition, Addison-Wesley,2014
• C Programming Absolute Beginners Guide, Greg Perry, Dean Miller , 3rd Edition, Que
Publishing,2013
• Let Us C, by Yashavant P. Kanetkar, 8th Edition, Jones & Bartlett Learning,2008
• How To Program, Paul Deitel, Harvey Deitel, 9th Edition, 2022
Attendance
• As per SZABIST Official Policy
• Maximum THREE Absences allowed in CS Program ( 180 Minutes
Fundamentals of Programming

Classes )

13
What to avoid?
• Things to avoid
• Coming late
Fundamentals of Programming

• Marked late if found absent during attendance.


• Two lates are considered equivalent to 1 absent

• Use of Mobile phones during lecture


• Strictly prohibited

• Disturbing others during lecture

• Plagiarism

14
Plagiarism
• You must never copy solutions from any source or give your
homework to another student. Cheating will result in a failing grade
Fundamentals of Programming

for the course.

• However, you are allowed and encouraged to discuss the exercises.


This means asking for suggestions when you are stuck and discussing
examples that are similar but not part of the exercise. You must never
share code or solutions to the assigned problems.

15
Course Syllabus
• Introducing C
• First Program in C
Fundamentals of Programming

• C Fundamentals
• Formatted Input / Output
• Expressions, Basic Types
• Selection Statements
• Loops, Nested Loops
• Arrays
• Functions

16
Course Syllabus
• Passing Arguments to Functions
• Scope Rules
Fundamentals of Programming

• Program Organization
• Debugging and Error Tracking
• Pointers
• Pointers for Array Processing
• String, [ Searching, Sorting]
• Structures, Unions, Enumerations
• Filing

17
Online Learning
• Coursera, https://www.coursera.org/

• Udemy, https://www.udemy.com/
Fundamentals of Programming

• edX, https://www.edx.org/

• Stanford Engineering Everywhere, http://see.stanford.edu/see/courses.aspx

• MITOpenCourseWare https://ocw.mit.edu

• Big Data University, http://bigdatauniversity.com/

• OpenSAP, https://open.sap.com/

• Khan Academy, http://www.khanacademy.org/

18
Online Learning
• Udacity, http://www.udacity.com/
• Skillshare, http://www.skillshare.com/
Fundamentals of Programming

• Venture Lab, https://venturelab.stanford.edu/

19
Class Focal Person
• Class Representative.
• Name?
Fundamentals of Programming

20
Any Questions?
• Should you have any questions, please don’t hesitate to ask.
Fundamentals of Programming

21
Course Pre-requisites
• Not Applicable
Fundamentals of Programming
Keys to success
• Code, code and code….
• You can’t remember coding….
Fundamentals of Programming

• You can’t learn coding…


• You practice and learn coding…
• Practical hands on experience of real world programming problems is very
helpful.
• Find yourself problems beyond what is discussed in class.
• Always read/revise previous lectures before coming to class or any related
material discussed previously.
• Looking up and solutions, and assignment are always very important

23
Good Computer Scientist
• Self-learner
• Desire for innovations
Fundamentals of Programming

• Think logically
• Avoids distractions and follows a plan
• Keeps patience and focuses on the target
• Over the time acquires knowledge of computer science application
domains
• Is a good team worker with good communication skills
• Takes care of his/her health
24
Background Info
• What is DOS?
Fundamentals of Programming

• What is command line interface?

• What is a command prompt?

• What is an executable file?

25
Fundamentals of Programming

Sample C Program
Sample C Program
/* Illustrates comments, strings, and the printf function */
Fundamentals of Programming

#include <stdio.h>
int main(void)
{
printf("To C, or not to C: ");
printf("that is the question.\n");
return 0;
}
Sample C Program (contd.)
Writing a sample C program would help us understand the answers to following
questions.
Fundamentals of Programming

• What is an editor?

• How to write a program?

• How to compile a program?

• How to run/execute a program?

• How to debug a program?

• What is an output of a program?


Fundamentals of Programming

C
Chapter 1: INTRODUCING
History of C
• Designed and implemented by Dennis Ritchie of Bell Labs between 1969 and 1973.

• Created to serve as the implementation language for the UNIX operating system.
Fundamentals of Programming

• Named after the B language, its immediate predecessor (B language was based on BCPL,
a system programming language).

• Became popular during the 1980s, both for UNIX programming and for developing
applications for personal computers.

• Dennis Ritchie’s article, “The Development of the C Language,” can be found on the web
at cm.bell-labs.com/cm/cs/who/dmr/chist.html.
Versions of C
• K&R C
Described in Kernighan and Ritchie, The C Programming Language, Prentice-Hall, 1978

• ANSI C (ISO C, C89)


Fundamentals of Programming

ANSI standard X3.159-1989 (completed in 1988; formally approved in December 1989)

International standard ISO/IEC 9899:1990


Described in Kernighan and Ritchie, The C Programming Language, Second Edition,
Prentice-Hall, 1988

• C99
International standard ISO/IEC 9899:1999
Advantages of C
• Advantages

– Efficient: Runs quickly, Programs may execute on systems with limited memory.
Fundamentals of Programming

– Portable: Program can run from PCs to Supercomputers

– Powerful: Lots of data types and operators

– Flexible: Used for both system programming and applications

– Standard library: Rich set of features

– Integrated well with UNIX: Self explanatory.


Disadvantages of C
• Disadvantages
– Error-prone
Fundamentals of Programming

– Difficult to understand

– Difficult to maintain
Recommendations
• Recommendations

– Use tools (lint, debuggers, etc.) to make programs more reliable.


Fundamentals of Programming

– Use libraries of existing code (both to save time and increase reliability).

– Adopt a sensible set of coding conventions.

– Avoid “tricks” and complicated code.


Creating, Compiling and Running Your
Program
Creating the program
Tools: Turbo C (IDE), Dev C++ (IDE), Codeblocks, vi or textedit or emacs on unix/linux.
Filename: helloworld.c (The filename must by convention end with “.c” full stop,
Fundamentals of Programming

lower case c)

Compiling the program


cc  default sun compiler
gcc  GNU c compiler
bcc  Borland compiler for PC users.
On UNIX: cc program.c ----------- Result: (a.out) object file generated
cc –o program program.c ---Result: (program) object file generated
Creating, Compiling and Running Your
Program
• Compiling the Program:

• Turbo C: Alt+F9
Fundamentals of Programming

• Dev C++ / CodeBlocks: Ctrl+F9

• Executing the program:

• Turbo C: Ctrl+F9
• Dev C++/CodeBlocks: Ctrl+F10

• Compile and Execute the Program:

• CodeBlocks F9
Let’s Program
• Steps:
• Open Dev C++ IDE
Fundamentals of Programming

• Create a New Project


• Write sample program
• Compile program
• Debug errors, if any (optional)
• Execute program
• Review program output
Open Dev C++ IDE
• Let’s Do It
Fundamentals of Programming
Create a New Project
• Let’s Do It
Fundamentals of Programming
Write sample Program
• Let’s Do It...
/* Illustrates comments, strings, and the printf function */
Fundamentals of Programming

#include <stdio.h>
int main(void)
{
printf("To C, or not to C: ");
printf("that is the question.\n");
return 0;
}
Compile Program
• Let’s Do It…
Fundamentals of Programming
Debugging Program
• Let’s Do It…
Fundamentals of Programming
Executing Program
• Let’s Do It…
Fundamentals of Programming
Review Program Output
• Let’s Do It…
Fundamentals of Programming
Practice
• Use of printf();
• Use of getche();
Fundamentals of Programming

• Use of clrscr();
• Use of newline character \n
• declaring a variable - integer
• printing a variable - integer
• Format Specifier for integer %d
Use of printf();
Task: Print your name….
Fundamentals of Programming

#include <stdio.h>
int main(void)
{
printf(“My name is ");
printf(“Ahmed Ali\n");
return 0;
}
Practice
• Use of printf();
• Use of getche();
Fundamentals of Programming

• Use of clrscr();
• Use of newline character \n
• declaring a variable - integer
• printing a variable - integer
• Format Specifier for integer %d
Sample C Program (contd.)
It’s time to answer following questions.

• What is an editor?
Fundamentals of Programming

• How to write a program?

• How to compile a program?

• How to run/execute a program?

• How to debug a program?

• What is an output of a program?


C Program Compilation

C Code
Fundamentals of Programming
C Program Compilation (Another
View)
Fundamentals of Programming
Preprocessor

The Preprocessor accepts source code as input and is responsible for:


• removing comments
Fundamentals of Programming

• interpreting special preprocessor directives denoted by #.

For example
#include -- includes contents of a named file. Files usually called header files. e.g
#include <math.h> -- standard library maths file.
#include <stdio.h> -- standard library I/O file
#define -- defines a symbolic name or constant. Macro substitution.
#define MAX_ARRAY_SIZE 100
C Compiler

• The C compiler translates source to assembly code.


• The source code is received from the preprocessor.
Fundamentals of Programming
Assembler

• The assembler creates object code that represents Machine Code or


Fundamentals of Programming

low level instructions for the processor.

• On a UNIX system you may see files with a .o suffix (.OBJ on MSDOS)
to indicate object code files.
Link Editor

If a source file references library functions or functions defined in other


Fundamentals of Programming

source files the link editor combines these functions (with main()) to
create an executable file ( .exe file ) . External Variable references are
also resolved here.

You might also like