You are on page 1of 44

ECAP010

PROGRAMMING IN C
Learning objectives - Course
Outcomes
C01 CO3
C02
Analyze of a problem by Demonstrate the data
developing algorithm based Define an algorithm and Types and use them in
on modern programming draw flowcharts for solving simple data processing
techniques Mathematical and applications
Engineering problems

CO4
Understand the computer
programming language
concepts
ECAP172 Programming in C
1. Introduction to C Programming 8. Array Applications

2. Constant and Variables 9. String

3. Unformatted and Formatted I/O 10. Storage Classes


4. Datatypes & Operators
11. Pointers
5. Control Statements
12. Dynamic Memory Management
6. Functions
13. Structures and Union
7. Arrays
14. File Structures
Live Lectures

Introduction C programming Decision Statements


Various Datatypes , • Control statements
• Definition Basic concepts
• Different than other language keywords, constants • Looping statements

Functions
Dynamic Memory Management
•Library functions Storage Classes Arrays & Pointers
•User Defined Functions & structures and Union
Lecture Plan

12 Live Lectures

06
Weeks
How the classes are ?

Online Classes

Synchronous Asynchronous
Learning Learning

Recorded
Live Lectures
Videos, SLM
Where we can interact ?

1 2

LPU
LPU Live
Discussions
Online Coding Practice
Online and Offline Compilers

 Offline Compiler
Turbo C
Dev C++
Borland
 Online Compiler
https://www.programiz.com/c-programming/online-compiler/
https://www.jdoodle.com/c-online-compiler/
Learning Outcomes

After this lecture, you will be able to


• Understand basic of programming language
▪ Types of programming languages

▪ Translators

• Explain characteristics of programming language


• Identify applications of programming language
Introduction
Computer is an electronic device which works on the
instructions provided by the user. As the computer
does not understand natural language, it is required to
provide the instructions in some computer
understandable language.
Introduction
A computer programming language consists of a set of

 symbols and characters,

 words, and

 grammar rules

that permit people to construct instructions in the format that can be


interpreted by the computer system
Programming domain
Programming domains deals with the areas & computer
applications and their associated languages.
 Business applications

 Systems Programming

 Artificial intelligence.

 Web development.

 Scripting Programming Language


Machine Language
A [0,1]

Type of Assembly Language

Languages B [Mnemonic codes e.g., ADD,


SUB]

High-Level Language
C [BASIC, C, SQL, C++]
Machine Language

Natural language of a particular computer

Primitive instructions built into every computer

Any other types of languages must be translated down to this


level
B
Assembly Language
Programming using machine language is a very tedious and
cumbersome task. Therefore, need was felt to improve the
programming structure. The mnemonics (abbreviated names)
were developed to substitute the operation codes.

Mnemonic Description
Assign (copy) source operand to destination
MOV
operand.
ADD Perform addition operation.

SUB Perform subtraction operation.

DIV Perform division operation.


C
High-level Languages
Easy to understand

Easy to interpret / compile

Easy to debug

Platform independent/ portable


Comparison
Language Time to Execute

Since it is the basic language of the computer, it


Machine does not require any translation, and hence
Language ensures better machine efficiency. This means the
programs run faster
A program called an ‘assembler’ is required to
Assembly convert the program into machine language.
Language Thus, it takes longer to execute than a machine
language program.
A program called a compiler on interpreter is
High-level
required to convert the program into machine
Language
language. Thus, it takes more time for a computer
s
to execute.
Comparison
Language Time to Develop

Machine Needs a lot of skill, as instructions are very lengthy


Language and complex. Thus, it takes more time to program.

Simpler to use than machine language, though


Assembly instruction codes must be memorized. It takes less
Language time to develop programs as compared to
machine language.

High-level
Easiest to use. Takes less time to develop programs
Language
and, hence ensures better program efficiency.
s
Translator

Executable
Source
Compiler (Machine
Code Code)
Translator

Assembler Compiler Interpreter

It is used to translate Turbo C++ Perl, Python


the program written in Matlab
Assembly language
into machine code.
Source Code
Source code is generally understood to mean programming statements
that are created by a programmer with a text editor or a visual
programming tool and then saved in a file.
Source Code

#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
Object code

Object code generally refers to the output, a compiled


file, which is produced when the Source Code is
compiled with a C compiler
Characteristics of a Programming Language
 Simple
 Easy to Learn & Use
 have good readability
 Human Recognizable
 Highly Efficient
▪ Easily to translate into Machine Code

▪ Consume Less Memory

▪ Fast Execution
 Development Tools (debugging, testing,
maintenance)
 Integrated Development Environment(IDE)
Storage Capacities

 bit – smallest unit

 nibble = 4 bits

 byte = 2 nibbles = 8 bits

 1 kilobyte (KB) = 1024 bytes

 1 megabyte (MB) = 1024 KB

 1 gigabyte (GB) = 1024 MB


Parts of a Computer System - Hardware

Hardware: Computer hardware includes the physical


parts of a computer, such as the case, central
processing unit (CPU), monitor, mouse, keyboard etc.
Parts of a Computer System - Software

Software: Computer software is a collection of data or


computer instructions that tell the computer how to work.
These are categorised in 2 parts: system software and
application software.
Quiz
 Which one is not the application of programming language ?
A. Operating System
B. GUI
C. Gaming
D. Driver
Applications Of Programming Languages
 Operating System

 Embedded Systems

 GUI

 Database Software Platforms

 Compiler Design

 Gaming and Animation

 Mobile Apps
Stages in program development
 Problem Definition/ identification

 Program Design/ Algorithm Development

 Coding & Documentation

 Testing & Debugging

 Maintenance
Problem Definition/ identification
 First step is to define/ identification the problem statement and
boundaries of the problem

 Input/output

 Processing requirement

 Memory requirements

 Error handling
Program Design/ Algorithm Development

Algorithm
 step by step procedure to solve the problem

Flowchart
Pictorial representation of workflow/ process
Coding
 Selection of programming language

 Write programming instructions for steps defined in previous phase

 Syntax error, Logical error

 Missing commas, undefined labels


Debugging

 Errors detection and correction in program

 Debugging is also known as program validation.


Testing

 Program is tested for different test cases

 Whether program is performing according to given input data or not

 White box ,black box testing etc.


Maintenance
 Updating/ correction according to user feed back

 Change in specification,

 Error traced during actual execution of program


Algorithm
 It is set of instructions in sequence to solve problem.

 Clear and Unambiguous

 Well defined input outputs

 Finiteness
Flowcharts
 It is a pictorial representation of a process, system or computer algorithm

 Flowcharts use rectangles, ovals, diamonds and other shapes to define


the type of step, along with connecting arrows to define flow and
sequence
Flowchart symbols
Strat/ Stop

Process

Arrows

Decision

Input/ Output
Flowchart example
Start

Enter value
of a and b

C=a+b

Sum is = C

Stop
Programming methodologies

It is method or process to solve complex problem by analyze, planning,


design and control using different programming techniques.
Programming methodologies
 Procedural Programming

 Object-oriented Programming

 Functional Programming

You might also like