0% found this document useful (0 votes)
22 views17 pages

Cse-103: Structured Programming Lecture 1: Basics of C: Course Instructor: Bijan Paul

The document outlines the CSE-103 course on Structured Programming, taught by Bijan Paul, covering the basics of C programming. It includes course details, reference materials, and an introduction to computer languages, emphasizing practical learning and the importance of assignments. Key topics include the structure of C programs, the role of comments, semicolons, and header files in programming.

Uploaded by

ahnafatif87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views17 pages

Cse-103: Structured Programming Lecture 1: Basics of C: Course Instructor: Bijan Paul

The document outlines the CSE-103 course on Structured Programming, taught by Bijan Paul, covering the basics of C programming. It includes course details, reference materials, and an introduction to computer languages, emphasizing practical learning and the importance of assignments. Key topics include the structure of C programs, the role of comments, semicolons, and header files in programming.

Uploaded by

ahnafatif87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

CSE-103: STRUCTURED PROGRAMMING

LECTURE 1: BASICS OF C

Course Instructor: Bijan Paul


CSE-103
2

◻ Course Code: CSE-103


◻ Course Title: Structured Programming
◻ Course Teacher: Bijan Paul
◻ Credit: 3
◻ Lecture: 24
Introduce Yourself
3

◻ Your name, College name?


◻ Do you have a computer of your own?
◻ Any previous experience on programming?
Reference Book
4

◻ Text:
Teach Yourself C (3rd Edition) – Herbert Schildt
C – How to Program (4th Edition) – Deitel & Deitel
◻ Other Reference Book:
Schaum’s Outlines: Programming with C (2nd Edition) –
Byron Gottfried
Programming in ANSI C – Balagurusamy
About the Course
5

◻ Hardware vs. Software


◻ System Software vs. Application Software
◻ Operating System
◻ What is language? Programming language?
◻ What should we expect after completion this
course?
Learning Style
6

◻ This course is practical oriented.


◻ We will give lots of assignments.
(because practice makes a man perfect ☺ )
◻ Memorization will not help you to get a good
result.
◻ Copying Code:
Strictly prohibited.
Will be severely punished if you are caught.
7
What is Computer?
◻ Computer
Device capable of performing computations and making
logical decisions
Computers process data under the control of sets of
instructions called computer programs
◻ Hardware
Keyboard, screen, mouse, disks, memory, CD-ROM, and
processing units
◻ Software
Programs that run on a computer
Machine Languages, Assembly
Languages, and High-level Languages
8

◻ Three types of computer languages


1. Machine language
■ Only language computer directly understands
■ “Natural language” of computer
■ Defined by hardware design
■ Machine-dependent
■ Generally consist of strings of numbers
■ Ultimately 0s and 1s
■ Instruct computers to perform elementary operations
■ One at a time
■ Burdensome for humans
Machine Languages, Assembly
Languages, and High-level Languages
9

2. Assembly language
■ An assembly language is a low-level programming
language for microprocessors and other programmable
devices.
■ An assembly language implements a symbolic
representation of the machine code needed to program a
given CPU architecture.
■ Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
Machine Languages, Assembly
Languages, and High-level Languages
10
3. High-level languages
■ A high-level language is a programming language such
as C, FORTRAN, or Pascal that enables
a programmer to write programs that are more or less
independent of a particular type of computer.
Such languages are considered high-level because they
are closer to human languages
■ The main advantage of high-level languages
over low-level languages is that they are easier to read,
write, and maintain.
■ Ultimately, programs written in a high-level language
must be translated into machine language by
a compiler or interpreter.
C Programming Environment

Preprocess/
Compile/
Link
Load/
Edit Run
[Link]
Editor test.c CPU
e
First C Program
12

/* My first simple C program */


#include <stdio.h> Comments
void main ()
All C programs have a main function;
{ they also start at main

printf (" Welcome to C!\n ");


} Function to print to screen

Braces indicate start What to print End of


and end of main statement
End of line
Let’s look into various parts of C program
13

*/Comments */ This is a comment block, which is ignored by the compiler.


Comment can be used anywhere in the program to add info about
program or code block, which will be helpful for developers to
easily understand the existing code in the future.

#include<stdio.h> stdio is standard for input / output, that notify the compiler to
include the header file stdio.h in the program before compiling
the source-code.
void main() This is the main function, which is the default entry point for
every C program and the void in front of it indicates that it does
not return a value.
Braces Two curly brackets “{…}” are used to group all statements
together.
printf() It is a function in C, which prints text on the screen.
Semicolons
14

◻ In a C program, the semicolon is a statement


terminator. That is, each individual statement must
be ended with a semicolon. It indicates the end of
one logical entity.
◻ Given below are two different statements −
int var;
var = 10;
printf(“The value is = %d“, var);
Comments
15

◻ Comments are like helping text in your C program


and they are ignored by the compiler.
◻ For multiple line comment start with /* and
terminate with the characters */ as shown below −
/* my first
program in
C Language */
◻ Single line comment can be done by using // as
shown below −
// my first program in C Language
Header File
16

◻ A header file in C programming language is a file with .h extension which


contains a set of common function declarations and macro definitions
which can be shared across multiple program files.
◻ Each header file contains information (or declarations) for a particular
group of functions. Like stdio.h header file contains declarations of
standard input and output functions available in C which is used for get the
input and print the output. Similarly, the header file math.h contains
declarations of mathematical functions available in C.
◻ When we want to use any function in our c program then first we need to
import their definition from c library, for importing their declaration and
definition we need to include header file in program by using #include.
Header file include at the top of any C program.
◻ For example if we use printf() in C program, then we need to include,
stdio.h header file, because in stdio.h header file definition of printf() (for
print message on screen) is written in stdio.h header file.
Thank You

You might also like