SlideShare a Scribd company logo
 KIIT 2014
1
Introduction to Computer
Networks
 KIIT 2014
Objectives
After completing this lesson, you should be able to do the
following:
• Introduction to Computer Networks
• Evolution of Networking
• Types of Networks
• Network Devices
• Networking Topologies
• Define Node in the Network
• Use of Internet and WEB
• Define DNS
 KIIT 2014
Introduction to Computer
Networks
• Information is being produced, exchanged, and
traced across the globe in real time. It's possible as
almost everyone and everything in the digital world is
interconnected through one way or the other.
• A group of two or more similar things or people
interconnected with each other is called network.
• Examples of network in our daily life:
– Social network
– Mobile network
– Network of computers
– Airlines, railway, banks, hospitals networks
 KIIT 2014
Introduction to Computer
Networks
• A computer network is an interconnection among
two or more computers or computing devices.
• A basic network may connect a few computers placed
in a room. The network size may vary from small to
large depending on the number of computers it
connects.
• A computer network can include different types of
hosts (also called nodes) like server, desktop, laptop,
cellular phones.
 KIIT 2014
Why Use C?
• Mainly because it produces code that runs nearly as fast
as code written in assembly language. Some examples of
the use of C might be:
– Operating Systems
– Language Compilers
– Assemblers
– Text Editors
– Network Drivers
– Modern Programs
– Data Bases
– Language Interpreters
– Utilities
 KIIT 2014
History of C
• Evolved from two previous languages
– BCPL , B
• BCPL (Basic Combined Programming
Language) used for writing OS & compilers
• B used for creating early versions of UNIX OS
• Both were “typeless” languages
• C language evolved from B (Dennis Ritchie –
Bell labs)
** Typeless – no datatypes. Every data item occupied 1 word in
memory.
 KIIT 2014
History of C
• In 1972 Dennis Ritchie at Bell Labs writes C
and in 1978 the publication of The C
Programming Language by Kernighan &
Ritchie caused a revolution in the computing
world
• In 1983, the American National Standards
Institute (ANSI) established a committee to
provide a modern, comprehensive definition
of C. The resulting definition, the ANSI
standard, or "ANSI C", was completed late
1988.
 KIIT 2014
Capabilities of C
• Low Level Language Features
• Portability
• Powerful
• Bit Manipulation
• High Level Language Features
• Modular Programming
• Efficient use of Pointers
 KIIT 2014
Software Development
Method
• Requirement Specification
– Problem Definition
• Analysis
– Refine, Generalize, Decompose the problem definition
• Design
– Develop Algorithm
• Implementation
– Write Code
• Verification and Testing
– Test and Debug the code
 KIIT 2014
Development with C
• Four stages
– Editing: Writing the source code by using some IDE or editor
– Preprocessing or libraries: Already available routines
– Compiling: translates or converts source to object code for a
specific platform source code -> object code
– Linking: resolves external references and produces the
executable module
• Portable programs will run on any machine
Note: Program correctness and robustness are most important than
program efficiency
 KIIT 2014
Programming languages
• Various programming languages
• Some understandable directly by computers
• Others require “translation” steps
– Machine language
• Natural language of a particular computer
• Consists of strings of numbers(1s, 0s)
• Instruct computer to perform elementary
operations one at a time
• Machine dependant
 KIIT 2014
Programming languages
• Assembly Language
– English like abbreviations
– Translators programs called “Assemblers” to convert
assembly language programs to machine language
– E.g. add overtime to base pay and store result in gross pay
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
 KIIT 2014
Programming languages
• High-level languages
– To speed up programming even further
– Single statements for accomplishing substantial
tasks
– Translator programs called “Compilers” to convert
high-level programs into machine language
– E.g. add overtime to base pay and store result in
gross pay
grossPay = basePay + overtimePay
 KIIT 2014
C Standard Library
• Two parts to learning the “C” world
– Learn C itself
– Take advantage of rich collection of existing
functions called C Standard Library
• Avoid reinventing the wheel
• SW reusability
 KIIT 2014
Basics of C Environment
• C systems consist of 3 parts
– Environment
– Language
– C Standard Library
• Development environment has 6 phases
– Edit
– Pre-processor
– Compile
– Link
– Load
– Execute
 KIIT 2014
Basics of C Environment
Editor Disk
Phase 1
Program edited in
Editor and stored
on disk
Preprocessor Disk
Phase 2
Preprocessor
program processes
the code
Compiler Disk
Phase 3
Creates object code
and stores on disk
Linker Disk
Phase 4
Links object code
with libraries and
stores on disk
 KIIT 2014
Basics of C Environment
Loader
Phase 5
Puts program in
memory
Primary memory
CPU
Phase 6
Takes each instruction
and executes it storing
new data values
Primary memory
 KIIT 2014
C Program Example
A C program basically consists of the following
parts:
• Preprocessor Commands
• Functions
• Variables
• Statements & Expressions
• Comments
 KIIT 2014
 KIIT 2014
Simple C Program
/* A first C Program*/
#include <stdio.h>
void main()
{
printf("Hello World n");
}
 KIIT 2014
Simple C Program
• Line 1: #include <stdio.h>
– As part of compilation, the C compiler runs a
program called the C preprocessor. The
preprocessor is able to add and remove code from
your source file.
– In this case, the directive #include tells the
preprocessor to include code from the file stdio.h.
– This file contains declarations for functions that
the program needs to use. A declaration for the
printf function is in this file.
 KIIT 2014
Simple C Program
• Line 2: void main()
– This statement declares the main function.
– A ‘C’ program can contain many functions but
must always have one main function.
– A function is a self-contained module of code that
can accomplish some task.
– Functions are examined later.
– The "void" specifies the return type of main. In this
case, nothing is returned to the operating system.
 KIIT 2014
Simple C Program
• Line 3: {
– This opening bracket denotes the start of the
program.
 KIIT 2014
Simple C Program
• Line 4: printf("Hello World n");
– printf is a function from a standard C library that is
used to print strings to the standard output, normally
your screen.
– The compiler links code from these standard libraries
to the code you have written to produce the final
executable.
– The "n" is a special format modifier that tells the
printf to put a line feed at the end of the line.
– If there were another printf in this program, its string
would print on the next line.
 KIIT 2014
Simple C Program
• Line 5: }
– This closing bracket denotes the end of the
program.
 KIIT 2014
Compile & Execute C Program
Following are the simple steps:
• Open a text editor and add the above-mentioned code.
• Save the file as hello.c
• Open a command prompt and go to the directory where
you saved the file.
• Type gcc hello.c and press enter to compile your code.
• If there are no errors in your code, the command prompt
will take you to the next line and would generate a.out
executable file.
• Now, type a.out to execute your prog ram.
• You will be able to see "Hello World" printed on the
screen
 KIIT 2014
Summary
In this lesson, you should have learned how to:
• Define C language
• List the capabilities of C language
• Define Software Development Method
• Develop software with C
• Write programs in different types of Languages
• Write Simple C Program
• Compile & Execute C Program
 KIIT 2014
Escape Sequence
• n new line
• t tab
• r carriage return
• a alert
•  backslash
• ” double quote
 KIIT 2014
Memory concepts
• Every variable has a name, type and value
• Variable names correspond to locations in
computer memory
• New value over-writes the previous value–
“Destructive read-in”
• Value reading called “Non-destructive read-
out”
 KIIT 2014
Arithmetic in C
C operation Algebric C
Addition(+) f+7 f+7
Subtraction (-) p-c p-c
Multiplication(*) bm b*m
Division(/) x/y, x , x y x/y
Modulus(%) r mod s r%s
 KIIT 2014
Precedence order
• Highest to lowest
– ()
– *, /, %
– +, -
 KIIT 2014
Example
Algebra:
z = pr%q+w/x-y
C:
z = p * r % q + w
/ x – y ;
Precedence:
1 2 4 3 5
 KIIT 2014
Example
Algebra:
a(b+c)+ c(d+e)
C:
a * ( b + c ) + c
* ( d + e ) ;
Precedence:
3 1 5
4 2
 KIIT 2014
Decision Making
• Checking falsity or truth of a statement
• Equality operators have lower precedence
than relational operators
• Relational operators have same precedence
• Both associate from left to right
 KIIT 2014
Decision Making
• Equality operators
– ==
– !=
• Relational operators
– <
– >
– <=
– >=
 KIIT 2014
Summary of precedence
order
Operator Associativity
() left to right
* / % left to right
+ - left to right
< <= > >= left to right
== != left to right
= left to right
 KIIT 2014
Assignment operators
• =
• +=
• -=
• *=
• /=
• %=
 KIIT 2014
Increment/ decrement
operators
• ++ ++a
• ++ a++
• -- --a
• -- a--
 KIIT 2014
Increment/ decrement
operators
main()
{
int c;
c = 5;
printf(“%dn”, c);
printf(“%dn”, c++);
printf(“%dnn”, c);
c = 5;
printf(“%dn”, c);
printf(“%dn”, ++c);
printf(“%dn”, c);
return 0;
}
 KIIT 2014

More Related Content

PPTX
Introduction to Web development & HTML Programming
PPTX
CSE_1201_Lecture_1_Introduction_to_Programming_0fd134f8149173dfa0821f1575f733...
PPTX
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
PPTX
PPTX
PPTX
UNIT - 1jhjhjbkjhkjhkjhkjhkjhhkkhhh.pptx
PPTX
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
PPT
1. over view and history of c
Introduction to Web development & HTML Programming
CSE_1201_Lecture_1_Introduction_to_Programming_0fd134f8149173dfa0821f1575f733...
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
UNIT - 1jhjhjbkjhkjhkjhkjhkjhhkkhhh.pptx
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
1. over view and history of c

Similar to Introduction to Computer Networks and Networking (20)

PPTX
Introduction to C programming
PPTX
C session 1.pptx
PPT
C_Intro.ppt
PPTX
C_Programming_Notes_ICE
PPTX
Unit ii
PPT
C PROGRAMMING
PPT
C intro
PPT
01 c
PPTX
Introduction to C programming
PPTX
Basics of C Lecture 2[16097].pptx
PDF
Introduction to C programming
PPTX
Introduction to C Programming
PDF
Understanding C and its Applications.pdf
PPT
C# Fundamental
PPTX
Introduction to computers, input and output devices
PPTX
Csc240 -lecture_3
PPTX
Master the Fundamentals of C Programming Language
PDF
67404923-C-Programming-Tutorials-Doc.pdf
PPTX
Computer Programming In C.pptx
PDF
Introduction to computers
Introduction to C programming
C session 1.pptx
C_Intro.ppt
C_Programming_Notes_ICE
Unit ii
C PROGRAMMING
C intro
01 c
Introduction to C programming
Basics of C Lecture 2[16097].pptx
Introduction to C programming
Introduction to C Programming
Understanding C and its Applications.pdf
C# Fundamental
Introduction to computers, input and output devices
Csc240 -lecture_3
Master the Fundamentals of C Programming Language
67404923-C-Programming-Tutorials-Doc.pdf
Computer Programming In C.pptx
Introduction to computers
Ad

Recently uploaded (20)

PDF
Insiders guide to clinical Medicine.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Basic Mud Logging Guide for educational purpose
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Pre independence Education in Inndia.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Structure & Organelles in detailed.
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Cell Types and Its function , kingdom of life
PDF
Classroom Observation Tools for Teachers
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Institutional Correction lecture only . . .
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Insiders guide to clinical Medicine.pdf
O7-L3 Supply Chain Operations - ICLT Program
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Basic Mud Logging Guide for educational purpose
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Final Presentation General Medicine 03-08-2024.pptx
Supply Chain Operations Speaking Notes -ICLT Program
VCE English Exam - Section C Student Revision Booklet
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pre independence Education in Inndia.pdf
Complications of Minimal Access Surgery at WLH
Cell Structure & Organelles in detailed.
Pharma ospi slides which help in ospi learning
Cell Types and Its function , kingdom of life
Classroom Observation Tools for Teachers
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Institutional Correction lecture only . . .
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Ad

Introduction to Computer Networks and Networking

  • 1.  KIIT 2014 1 Introduction to Computer Networks
  • 2.  KIIT 2014 Objectives After completing this lesson, you should be able to do the following: • Introduction to Computer Networks • Evolution of Networking • Types of Networks • Network Devices • Networking Topologies • Define Node in the Network • Use of Internet and WEB • Define DNS
  • 3.  KIIT 2014 Introduction to Computer Networks • Information is being produced, exchanged, and traced across the globe in real time. It's possible as almost everyone and everything in the digital world is interconnected through one way or the other. • A group of two or more similar things or people interconnected with each other is called network. • Examples of network in our daily life: – Social network – Mobile network – Network of computers – Airlines, railway, banks, hospitals networks
  • 4.  KIIT 2014 Introduction to Computer Networks • A computer network is an interconnection among two or more computers or computing devices. • A basic network may connect a few computers placed in a room. The network size may vary from small to large depending on the number of computers it connects. • A computer network can include different types of hosts (also called nodes) like server, desktop, laptop, cellular phones.
  • 5.  KIIT 2014 Why Use C? • Mainly because it produces code that runs nearly as fast as code written in assembly language. Some examples of the use of C might be: – Operating Systems – Language Compilers – Assemblers – Text Editors – Network Drivers – Modern Programs – Data Bases – Language Interpreters – Utilities
  • 6.  KIIT 2014 History of C • Evolved from two previous languages – BCPL , B • BCPL (Basic Combined Programming Language) used for writing OS & compilers • B used for creating early versions of UNIX OS • Both were “typeless” languages • C language evolved from B (Dennis Ritchie – Bell labs) ** Typeless – no datatypes. Every data item occupied 1 word in memory.
  • 7.  KIIT 2014 History of C • In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of The C Programming Language by Kernighan & Ritchie caused a revolution in the computing world • In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or "ANSI C", was completed late 1988.
  • 8.  KIIT 2014 Capabilities of C • Low Level Language Features • Portability • Powerful • Bit Manipulation • High Level Language Features • Modular Programming • Efficient use of Pointers
  • 9.  KIIT 2014 Software Development Method • Requirement Specification – Problem Definition • Analysis – Refine, Generalize, Decompose the problem definition • Design – Develop Algorithm • Implementation – Write Code • Verification and Testing – Test and Debug the code
  • 10.  KIIT 2014 Development with C • Four stages – Editing: Writing the source code by using some IDE or editor – Preprocessing or libraries: Already available routines – Compiling: translates or converts source to object code for a specific platform source code -> object code – Linking: resolves external references and produces the executable module • Portable programs will run on any machine Note: Program correctness and robustness are most important than program efficiency
  • 11.  KIIT 2014 Programming languages • Various programming languages • Some understandable directly by computers • Others require “translation” steps – Machine language • Natural language of a particular computer • Consists of strings of numbers(1s, 0s) • Instruct computer to perform elementary operations one at a time • Machine dependant
  • 12.  KIIT 2014 Programming languages • Assembly Language – English like abbreviations – Translators programs called “Assemblers” to convert assembly language programs to machine language – E.g. add overtime to base pay and store result in gross pay LOAD BASEPAY ADD OVERPAY STORE GROSSPAY
  • 13.  KIIT 2014 Programming languages • High-level languages – To speed up programming even further – Single statements for accomplishing substantial tasks – Translator programs called “Compilers” to convert high-level programs into machine language – E.g. add overtime to base pay and store result in gross pay grossPay = basePay + overtimePay
  • 14.  KIIT 2014 C Standard Library • Two parts to learning the “C” world – Learn C itself – Take advantage of rich collection of existing functions called C Standard Library • Avoid reinventing the wheel • SW reusability
  • 15.  KIIT 2014 Basics of C Environment • C systems consist of 3 parts – Environment – Language – C Standard Library • Development environment has 6 phases – Edit – Pre-processor – Compile – Link – Load – Execute
  • 16.  KIIT 2014 Basics of C Environment Editor Disk Phase 1 Program edited in Editor and stored on disk Preprocessor Disk Phase 2 Preprocessor program processes the code Compiler Disk Phase 3 Creates object code and stores on disk Linker Disk Phase 4 Links object code with libraries and stores on disk
  • 17.  KIIT 2014 Basics of C Environment Loader Phase 5 Puts program in memory Primary memory CPU Phase 6 Takes each instruction and executes it storing new data values Primary memory
  • 18.  KIIT 2014 C Program Example A C program basically consists of the following parts: • Preprocessor Commands • Functions • Variables • Statements & Expressions • Comments
  • 20.  KIIT 2014 Simple C Program /* A first C Program*/ #include <stdio.h> void main() { printf("Hello World n"); }
  • 21.  KIIT 2014 Simple C Program • Line 1: #include <stdio.h> – As part of compilation, the C compiler runs a program called the C preprocessor. The preprocessor is able to add and remove code from your source file. – In this case, the directive #include tells the preprocessor to include code from the file stdio.h. – This file contains declarations for functions that the program needs to use. A declaration for the printf function is in this file.
  • 22.  KIIT 2014 Simple C Program • Line 2: void main() – This statement declares the main function. – A ‘C’ program can contain many functions but must always have one main function. – A function is a self-contained module of code that can accomplish some task. – Functions are examined later. – The "void" specifies the return type of main. In this case, nothing is returned to the operating system.
  • 23.  KIIT 2014 Simple C Program • Line 3: { – This opening bracket denotes the start of the program.
  • 24.  KIIT 2014 Simple C Program • Line 4: printf("Hello World n"); – printf is a function from a standard C library that is used to print strings to the standard output, normally your screen. – The compiler links code from these standard libraries to the code you have written to produce the final executable. – The "n" is a special format modifier that tells the printf to put a line feed at the end of the line. – If there were another printf in this program, its string would print on the next line.
  • 25.  KIIT 2014 Simple C Program • Line 5: } – This closing bracket denotes the end of the program.
  • 26.  KIIT 2014 Compile & Execute C Program Following are the simple steps: • Open a text editor and add the above-mentioned code. • Save the file as hello.c • Open a command prompt and go to the directory where you saved the file. • Type gcc hello.c and press enter to compile your code. • If there are no errors in your code, the command prompt will take you to the next line and would generate a.out executable file. • Now, type a.out to execute your prog ram. • You will be able to see "Hello World" printed on the screen
  • 27.  KIIT 2014 Summary In this lesson, you should have learned how to: • Define C language • List the capabilities of C language • Define Software Development Method • Develop software with C • Write programs in different types of Languages • Write Simple C Program • Compile & Execute C Program
  • 28.  KIIT 2014 Escape Sequence • n new line • t tab • r carriage return • a alert • backslash • ” double quote
  • 29.  KIIT 2014 Memory concepts • Every variable has a name, type and value • Variable names correspond to locations in computer memory • New value over-writes the previous value– “Destructive read-in” • Value reading called “Non-destructive read- out”
  • 30.  KIIT 2014 Arithmetic in C C operation Algebric C Addition(+) f+7 f+7 Subtraction (-) p-c p-c Multiplication(*) bm b*m Division(/) x/y, x , x y x/y Modulus(%) r mod s r%s
  • 31.  KIIT 2014 Precedence order • Highest to lowest – () – *, /, % – +, -
  • 32.  KIIT 2014 Example Algebra: z = pr%q+w/x-y C: z = p * r % q + w / x – y ; Precedence: 1 2 4 3 5
  • 33.  KIIT 2014 Example Algebra: a(b+c)+ c(d+e) C: a * ( b + c ) + c * ( d + e ) ; Precedence: 3 1 5 4 2
  • 34.  KIIT 2014 Decision Making • Checking falsity or truth of a statement • Equality operators have lower precedence than relational operators • Relational operators have same precedence • Both associate from left to right
  • 35.  KIIT 2014 Decision Making • Equality operators – == – != • Relational operators – < – > – <= – >=
  • 36.  KIIT 2014 Summary of precedence order Operator Associativity () left to right * / % left to right + - left to right < <= > >= left to right == != left to right = left to right
  • 37.  KIIT 2014 Assignment operators • = • += • -= • *= • /= • %=
  • 38.  KIIT 2014 Increment/ decrement operators • ++ ++a • ++ a++ • -- --a • -- a--
  • 39.  KIIT 2014 Increment/ decrement operators main() { int c; c = 5; printf(“%dn”, c); printf(“%dn”, c++); printf(“%dnn”, c); c = 5; printf(“%dn”, c); printf(“%dn”, ++c); printf(“%dn”, c); return 0; }