C Programming Language and Data Structure: For DIT Students
C Programming Language and Data Structure: For DIT Students
and
Data Structure
Theory 100
Piratical 100
Total 200
Introduction to C
Programming
Introduction
Books
C provides:
Efficiency, high performance and high quality
Provide functionality through rich set of function libraries
Gateway for other professional languages like C C++ Java
C is used:
System software, Compilers, Editors
Graphics and Geometry
Databases, operating systems, device drivers
Also used in application programs
Software Development Method
Requirement Specification
– Problem Definition
Analysis
– Refine, Generalize the problem definition
Design
– Develop Algorithm: (A formula or set of steps for solving a
particular problem)
Implementation
– Write Code
Verification and Testing
– Test and Debug the code
How do you write a program?
1. Start
2. Get two numbers
3. Add them (a + b)
4. Print the answer
5. End
What does a flowchart look like?
Pseudo code Start
(Algorithm) :
Get 2 numbers
1. Start
2. Get two numbers
3. Add them (A + B) A+B
4. Print the answer
5. End
Print answer
End
Flow Chart symbols
START/END
INPUT/OUTPUT
PROCESS
DECISION
Integrated Development Environments
16
Simple C Program
/* A first C Program*/
#include <stdio.h>
void main()
{
printf("Hello World");
}
Simple C Program
/* A first C Program*/
Preprocessor directive
void main() Main Function
{ Opening bracket
} Closing Bracket
Simple C Program
Line 1: #include <stdio.h>
example:
/* A first C Program*/
Getting started with C
Steps in learning C
Constants
Alphabets Instruction Program
Variables
Digits
Keywords
Special-symbols
The C character Set
Digits 0,1,2,3,4,5,6,7,8,9
Example: 3x + y = 20
3 & 20 are constants, which cannot change
x & y can vary or change hence are called variables
Keywords
• Keywords are the words whose meaning has
already been explained to the C compiler
• Sometimes called reserved words.
• They cannot be used as variable names.
• There are only 32 keywords available in c
\n new line
\t tab
\a alert
\\ backslash
\” double quote
\0 Null
\b Backspace
Data Types
Editor
Source File
Preprocessor
Compiler
Linker
Executable File
Keywords