Professional Documents
Culture Documents
Introduction To Computer Programming With C Language
Introduction To Computer Programming With C Language
C Programming
Mahit Kumar Paul
Assistant Professor, Dept. of CSE
RUET, Rajshahi-6204
mahit.cse@gmail.com
mahit@cse.ruet.ac.bd
2023-10-05 1
Course Introduction
Couse No.: CSE 1111
Course Title: Computer Programming
Contact Hours/Week: 3
Credits: 3.00
Web-Link: https://www.tutorialspoint.com/cprogramming/
2023-10-05 3
What is C ?
• C is a general purpose, high level Computer
Programming Language.
• It can be used to create lists of instructions for a
computer to follow.
• It has been designed by Dennis M. Ritchie at Bell
Laboratories in the early 1970s to develop the UNIX
operating system.
• The UNIX operating system, the C compiler, all
UNIX application programs, Linux OS and RDBMS
MySQL have been written in C.
2023-10-05 4
Sample C Program
C program to add two integer numbers:
Source Code:
2023-10-05 5
Sample C Program…
Output:
Summation is: 15
2023-10-05 6
Sample C Program with comments
2023-10-05 7
Sample C Program…
Output:
Summation is: 15
2023-10-05 8
Structure of C Program…
C program basically consists of the following parts:
• Preprocessor Commands
• Functions
• Variables
• Comments
2023-10-05 9
Structure of C Program…
preprocessor
main() function
variable
expression
function
comment
2023-10-05 10
Preprocessor…
• Header files (*.h) export interface definitions:
Function prototypes, data types, macros, inline
functions and other common declarations.
2023-10-05 12
Preprocessor…
• Standard Headers you should know about:
2023-10-05 16
C-Basic Syntax
Keywords
• Reserved words in C.
2023-10-05 17
C-Basic Syntax
Some Keywords reserved in C
2023-10-05 18
C-Basic Syntax
Comments
2023-10-05 19
C-Basic Syntax
Comments Example
Block of lines
Single line
2023-10-05 20
C-Basic Syntax
Semicolon
• In a C program, the Semicolon is a
statement/expression terminator.
2023-10-05 21
C-Basic Syntax
Semicolon Example
Semicolon
2023-10-05 22
C-Basic Syntax
Data Types
2023-10-05 24
C-Basic Syntax
Various Data Types
2023-10-05 25
C-Basic Syntax
void Data Type
• The void type specifies that no value is available. It is used in three kinds of
situations-
2023-10-05 26
C-Basic Syntax
Other Data Types
• Pointer types.
• Array types
• Structure types
• Union types and
• Function types
• char
• integer
• float
• double
• void
2023-10-05 29
C-Basic Syntax
Variables Definition
• A variable definition specifies a data type and contains
a list of one or more variables of that type as follows:
type variable_list;
• Examples:
2023-10-05 30
2023-10-05 31