Bsc cs i pic u-1 introduction to c language

Rai University
Rai UniversityRai University
Course: BSC CS
Subject: Programming In C Language
Unit-1
Introduction to C language
Function OF Computer
 Input -- Input devices enable us to get information into a computer. Some
examples include a keyboard, mouse, microphone, scanner, or digital camera.
 Storage -- There are two types of storage: temporary and long-term.
RAM, or random access memory, is temporary, meaning it stores information as
you use it, but it is being constantly erased and rewritten as you open and close
files.
Long-term storage holds information for as long as you want it. Hard drives,
portable hard drives, floppy drives, flash drives, CD’s, and DVD’s are long term
storage devices.
 Processor -- A microprocessor controls the computers’ functions. It is smaller
than a dime, but contains millions of transistors that perform millions of
instructions per second. The microprocessor performs these instructions using a
three-step process: fetch, decode and execute.
 Output -- Information that has been processed is communicated back to the
user in the form of words, sounds or pictures, and is delivered through printers,
speakers, monitors or other output devices. Sometimes output is just written
back to a storage dev
Basic Building Block Of Computer
Control Unit-
this is the device or a part of computer responsible or
performs such regulating functions..
Arithmetic Logic Unit- this is the part or a circuitry of
the Microprocessor chip for arithmetic operations,
proportional and related functions, and logical
functions.
Memory- this is a part of computer or a card or modules
that inserted to the motherboard’s slot
Input -The System Unit that the system of computer
feeds or decode first the data before to display using the
output devices of computer.
Output Devices- this is refer to the devices of
computer that have an ability to display the information
or can produce a hardcopy of a document.
Computer Applications
Classification Of Computer
Classification Of Programming Language
What is UNIX?
 UNIX is an operating system which was first developed in
the 1960s, and has been under constant development ever
since. By operating system, we mean the suite of programs
which make the computer work. It is a stable, multi-user,
multi-tasking system for servers, desktops and laptops.
 UNIX systems also have a graphical user interface (GUI)
similar to Microsoft Windows which provides an easy to
use environment.
 However, knowledge of UNIX is required for operations
which aren't covered by a graphical program, or for when
there is no windows interface available, for example, in a
telnet session.
Cont..
 There are many different versions of UNIX, although
they share common similarities. The most popular
varieties of UNIX are Sun Solaris, GNU/Linux, and
MacOS X.
What is LINUX?
 It is the software on a computer that enables applications
and the computer operator to access the devices on the
computer to perform desired functions.
 Linux is developed collaboratively, meaning no one
company is solely responsible for its development or
ongoing support. Companies participating in the Linux
economy share research and development costs with
their partners and competitors
Windows
 The operating system gives the framework upon which all
other services and applications run. The majority of home
users use a Windows based machine. Most of today’s
applications and games are designed to run solely on
Microsoft systems.
 Microsoft Windows is extremely popular in schools and
colleges, many businesses also use Windows.
 The oldest of all Microsoft’s operating systems is MS-DOS
(Microsoft Disk Operating System). MS-DOS is a text-based
operating system. Users have to type commands rather than
use the more friendly graphical user interfaces
(GUI’s)available today
What is algorithm?
 A method that can be used by a computer for the solution
of a problem.
 A sequence of computational steps that transform the
input into the output.
 The word ”algorithm” comes from the name of a Persian
author, Abu Ja’far Mohammed ibn Musa al Khowarizmi (c.
825 A.D.), who wrote a textbook on mathematics.
 An algorithm (pronounced AL-go-rith-um) is a procedure
or formula for solving a problem.
Algorithm
Write an algorithm and draw the flowchart for finding
the average of two numbers Algorithm:
 Input: two numbers x and y
 Output: the average of x and y
 Steps:
 input x
 input y
 sum = x + y
 average = sum /2
 output average
Introduction to flowcharts
 A flowchart is a graphical representation of an algorithm.

• Start or end of the program

• Computational steps or processing function of a program


• Input or output operation


• Decision making and branching


• Connector or joining of two parts of program
Introduction of ‘C’
 Root of the morden language is ALGOL 1960. It’s first computer
language to use a block structure.
 It gave concept of structured programming.
 In 1967, Martin Richards developed a language, BCPL (Basic
Combined Programming Language)
 In 1970,by Ken Thompson created a language called as ‘B’.
It used to create early version of Unix.
 In 1972,by Dennis Ritchie introduced new language called as ‘C’ .
1972 Traditional C Dennis Ritchie
1990 ANSI/ISO C ISO Committee
1978 K&R C Kernighan &Ritchie
1989 ANSI C ANSI Committee
Features Of C
 It is robust lang whose rich setup of built in functions and operator can be used to write any
complex prog
 Prog written in c are efficient due to severals variety of data types and powerful operators.
 The c complier combines the capabilities of an assembly lang with the feature of high level
language. Therefore it is well suited for writing both system software and business package.
 There r only 32 keywords, severals standard functions r available which can be used for
developing prog.
 c is portable lang , this means that c programes written for one computer system can be run on
another system, with little or no modification.
 c lang is well suited for stuctured programming, this requires user to think of a problems in
terms of function or modules or block. A collection of these modules make a program
debugging and testing easier.
 c language has its ability to extend itself. A c program is basically a collection of functions that are
supported by the c library. We can contuniously add our own functions to the library with the
avaibility of the large number of functions.
 In india and abroad mostly people use c programming lang becoz it is easy to learn and
understand
Basic structure of C programming
 To write a C program, we first create functions and then put them together. A C program may contain one
or more sections. They are illustrated below.

 Documentation section
 Link section
 Definition section
 Global declaration section
 main () Function section
 {
 Declaration part
 Executable part


 }
 Subprogram section
 Function 1
 Function 2
 …………..
 …………..
 Function n (User defined functions)
Basic structure of ‘C’
Documentation Section
It has set of comment lines(name of program, author details).
What is Comment line??
 To guide a programmer to write a note for function,operation,logic in
between a program.
 Non-executable statement.
 Can’t be nested.
e.g:- /* Hello /* abc */ Hi */
ERROR.
Link Section
It provides instructions to the compiler to link function from
the system library.
# include Directive:-
 To access the functions which are stored in the library, it is
necessary to tell the compiler , about the file to be accessed.
Syntax:-
#include<stdio.h>
 stdio.h is header file.
Definition Section
 defines all symbolic constants.
 #define instruction defines value to a symbolic constant.
 #define:-
 It is a preprocessor compiler directive, not a statement.
 Therefore it should not end with a semicolon.
 Generally written in uppercase.
Global Declaration Section
 Some variables that are used in more than on function,
such variables (global variables) declared in the global
declaration section.
 It also declares all the user-defined function.
 Every ‘C’ program must have one main() function section.
 It contains two parts
1) Declaration part:
 It declares all variables used in the executable part.
2) Executable part:
 It has atleast one statement.
Main() function section
A simple C program: Printing a line of text
#include <stdio.h>
main()
{
printf(“hello, worldn”);
}
Program output:
hello, world
Executing a C program :
Executing a C program involves a series of steps.
They are,
 Creating the program.
 Compiling the program.
 Linking the program with functions that are needed
from the C library.
 Executing the program.
How to run a program?
 There are two ways to run programs written in a high-level
language.
 The most common is to Compile the program
 The other method is to pass the program through an interpreter.
Compiler
Why compiler is require ?
As machine (a processor) can operate On binary code instruction
only…..If we use higher level language then …For execution of the
program we must Convert it to lower level / machine level
Code.
Means,
A program that translates Source code into object code.
The compiler derives its name from the way it works, looking
at the entire piece of source code and collecting and
reorganizing the instructions.
Interpreter:
which analyzes and executes each line of source code
without looking at the entire program.
Advantage of interpreter:
It can execute a program immediately.
Compilers require some time before an executable program
emerges.
But,
However, programs produced by compilers Run much faster
than the same programs executed by an interpreter.
Compiler
checks for syntax errors if any on success coverts ‘C source
code into object code form which is nearer to machine…
process of compiling and running a C program
Bsc cs i pic u-1 introduction to c language
References:
1. Programming in C by yashwant kanitkar
2. ANSI C by E.balagurusamy- TMG publication
3. Computer programming and Utilization by sanjay shah Mahajan Publication
4. .www.cprogramming.com/books.html
5. en.wikipedia.org/wiki/C_(programming_language)
6. www.programmingsimplified.com/c-program-example
7. http://cm.bell-labs.com/cm/cs/who/dmr/chist.html
8. http://en.wikipedia.org/wiki/Comparison_of_programming_languages
9. http://en.wikipedia.org/wiki/List_of_C-based_programming_languages
10. http://en.wikipedia.org/wiki/C_(programming_language)
1 von 33

Recomendados

Mca i pic u-1 introduction to c language von
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageRai University
499 views33 Folien
Btech i pic u-1 introduction to c language von
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageRai University
547 views33 Folien
Diploma ii cfpc u-1 introduction to c language von
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c languageRai University
952 views33 Folien
What is turbo c and how it works von
What is turbo c and how it worksWhat is turbo c and how it works
What is turbo c and how it worksMark John Lado, MIT
2.5K views33 Folien
Computer programming - turbo c environment von
Computer programming - turbo c environmentComputer programming - turbo c environment
Computer programming - turbo c environmentJohn Paul Espino
2.4K views31 Folien
Turbo C von
Turbo CTurbo C
Turbo Cnat236
8.1K views43 Folien

Más contenido relacionado

Was ist angesagt?

WEBSITE DEVELOPMENT von
WEBSITE DEVELOPMENTWEBSITE DEVELOPMENT
WEBSITE DEVELOPMENTshahzadebaujiti
66 views89 Folien
Programming in c von
Programming in cProgramming in c
Programming in cvishnu973656
127 views28 Folien
Book ppt von
Book pptBook ppt
Book pptFALLEE31188
2.5K views406 Folien
Chapter 5 von
Chapter 5Chapter 5
Chapter 5meisaina
1.1K views18 Folien
Unit 1 von
Unit 1Unit 1
Unit 1TPLatchoumi
51 views147 Folien
Introduction to programming von
Introduction to programmingIntroduction to programming
Introduction to programmingNeeru Mittal
4.2K views18 Folien

Was ist angesagt?(20)

Chapter 5 von meisaina
Chapter 5Chapter 5
Chapter 5
meisaina1.1K views
Introduction to programming von Neeru Mittal
Introduction to programmingIntroduction to programming
Introduction to programming
Neeru Mittal4.2K views
Computer programming all chapters von Ibrahim Elewah
Computer programming all chaptersComputer programming all chapters
Computer programming all chapters
Ibrahim Elewah6.1K views

Destacado

Features of ms word tester von
Features of ms word   testerFeatures of ms word   tester
Features of ms word testerShiru123
395 views2 Folien
internet explorer von
internet explorerinternet explorer
internet explorernisma shaikh
5.8K views15 Folien
ITFT - Window explorer von
ITFT - Window explorerITFT - Window explorer
ITFT - Window explorerBlossom Sood
2.6K views20 Folien
WinSIG Windows & File Explorer von
WinSIG Windows & File ExplorerWinSIG Windows & File Explorer
WinSIG Windows & File Explorerhewie
793 views109 Folien
Power Point Lesson 10 Part1 von
Power Point  Lesson 10  Part1Power Point  Lesson 10  Part1
Power Point Lesson 10 Part1Nasir Jumani
1.2K views20 Folien
Windows File Explorer/Windows Explorer - The Basics von
Windows File Explorer/Windows Explorer - The BasicsWindows File Explorer/Windows Explorer - The Basics
Windows File Explorer/Windows Explorer - The Basicshewie
2.7K views35 Folien

Destacado(18)

Features of ms word tester von Shiru123
Features of ms word   testerFeatures of ms word   tester
Features of ms word tester
Shiru123395 views
ITFT - Window explorer von Blossom Sood
ITFT - Window explorerITFT - Window explorer
ITFT - Window explorer
Blossom Sood2.6K views
WinSIG Windows & File Explorer von hewie
WinSIG Windows & File ExplorerWinSIG Windows & File Explorer
WinSIG Windows & File Explorer
hewie793 views
Power Point Lesson 10 Part1 von Nasir Jumani
Power Point  Lesson 10  Part1Power Point  Lesson 10  Part1
Power Point Lesson 10 Part1
Nasir Jumani1.2K views
Windows File Explorer/Windows Explorer - The Basics von hewie
Windows File Explorer/Windows Explorer - The BasicsWindows File Explorer/Windows Explorer - The Basics
Windows File Explorer/Windows Explorer - The Basics
hewie2.7K views
Microsoft Office 2003 Creating Macros von S Burks
Microsoft Office 2003 Creating MacrosMicrosoft Office 2003 Creating Macros
Microsoft Office 2003 Creating Macros
S Burks5.6K views
20 unique features of MS-word von Akeeb Siddiqui
20 unique features of MS-word20 unique features of MS-word
20 unique features of MS-word
Akeeb Siddiqui49.2K views
Disk operating system von Raza Jaan
Disk operating systemDisk operating system
Disk operating system
Raza Jaan17.2K views
Ms excel and it’s function von sneha94
Ms excel and it’s functionMs excel and it’s function
Ms excel and it’s function
sneha9421.6K views
Planning for Windows 10 and Internet Explorer 11 von Flexera
Planning for Windows 10 and Internet Explorer 11 Planning for Windows 10 and Internet Explorer 11
Planning for Windows 10 and Internet Explorer 11
Flexera5.1K views
TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER von Rajat More
TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER
TYPES OF MEMORIES AND STORAGE DEVICE AND COMPUTER
Rajat More112.4K views
Project loon von Sneh Raval
Project loonProject loon
Project loon
Sneh Raval72.7K views

Similar a Bsc cs i pic u-1 introduction to c language

C Unit 1 notes PREPARED BY MVB REDDY von
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYRajeshkumar Reddy
701 views33 Folien
Introduction to c language von
Introduction to c language Introduction to c language
Introduction to c language BAKRANIYA KALPESH
193 views33 Folien
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf von
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
10 views125 Folien
Whole c++ lectures ITM1 Th von
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThAram Mohammed
428 views133 Folien
Programming_Fundamentals_Chapter_1_INTRO.pdf von
Programming_Fundamentals_Chapter_1_INTRO.pdfProgramming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdfBernardVelasco1
8 views31 Folien
Introduction von
IntroductionIntroduction
IntroductionKamran
281 views26 Folien

Similar a Bsc cs i pic u-1 introduction to c language(20)

Whole c++ lectures ITM1 Th von Aram Mohammed
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
Aram Mohammed428 views
Programming_Fundamentals_Chapter_1_INTRO.pdf von BernardVelasco1
Programming_Fundamentals_Chapter_1_INTRO.pdfProgramming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdf
BernardVelasco18 views
Introduction von Kamran
IntroductionIntroduction
Introduction
Kamran281 views
Introduction of c language von farishah
Introduction of c languageIntroduction of c language
Introduction of c language
farishah77 views
IP Lab Manual for Kerala University 3 Year UG Programme von SAFAD ISMAIL
IP Lab Manual for Kerala University 3 Year UG ProgrammeIP Lab Manual for Kerala University 3 Year UG Programme
IP Lab Manual for Kerala University 3 Year UG Programme
SAFAD ISMAIL188 views

Más de Rai University

Brochure Rai University von
Brochure Rai University Brochure Rai University
Brochure Rai University Rai University
2.5K views2 Folien
Mm unit 4point2 von
Mm unit 4point2Mm unit 4point2
Mm unit 4point2Rai University
4.5K views34 Folien
Mm unit 4point1 von
Mm unit 4point1Mm unit 4point1
Mm unit 4point1Rai University
2K views15 Folien
Mm unit 4point3 von
Mm unit 4point3Mm unit 4point3
Mm unit 4point3Rai University
1.5K views46 Folien
Mm unit 3point2 von
Mm unit 3point2Mm unit 3point2
Mm unit 3point2Rai University
1.2K views22 Folien
Mm unit 3point1 von
Mm unit 3point1Mm unit 3point1
Mm unit 3point1Rai University
1.3K views52 Folien

Más de Rai University(20)

Bdft ii, tmt, unit-iii, dyeing & types of dyeing, von Rai University
Bdft ii, tmt, unit-iii,  dyeing & types of dyeing,Bdft ii, tmt, unit-iii,  dyeing & types of dyeing,
Bdft ii, tmt, unit-iii, dyeing & types of dyeing,
Rai University922 views
Bsc agri 2 pae u-4.4 publicrevenue-presentation-130208082149-phpapp02 von Rai University
Bsc agri  2 pae  u-4.4 publicrevenue-presentation-130208082149-phpapp02Bsc agri  2 pae  u-4.4 publicrevenue-presentation-130208082149-phpapp02
Bsc agri 2 pae u-4.4 publicrevenue-presentation-130208082149-phpapp02
Rai University644 views
Bsc agri 2 pae u-4.3 public expenditure von Rai University
Bsc agri  2 pae  u-4.3 public expenditureBsc agri  2 pae  u-4.3 public expenditure
Bsc agri 2 pae u-4.3 public expenditure
Rai University1.1K views
Bsc agri 2 pae u-4.2 public finance von Rai University
Bsc agri  2 pae  u-4.2 public financeBsc agri  2 pae  u-4.2 public finance
Bsc agri 2 pae u-4.2 public finance
Rai University953 views
Bsc agri 2 pae u-4.1 introduction von Rai University
Bsc agri  2 pae  u-4.1 introductionBsc agri  2 pae  u-4.1 introduction
Bsc agri 2 pae u-4.1 introduction
Rai University872 views
Bsc agri 2 pae u-3.3 inflation von Rai University
Bsc agri  2 pae  u-3.3  inflationBsc agri  2 pae  u-3.3  inflation
Bsc agri 2 pae u-3.3 inflation
Rai University669 views
Bsc agri 2 pae u-3.2 introduction to macro economics von Rai University
Bsc agri  2 pae  u-3.2 introduction to macro economicsBsc agri  2 pae  u-3.2 introduction to macro economics
Bsc agri 2 pae u-3.2 introduction to macro economics
Rai University956 views
Bsc agri 2 pae u-3.1 marketstructure von Rai University
Bsc agri  2 pae  u-3.1 marketstructureBsc agri  2 pae  u-3.1 marketstructure
Bsc agri 2 pae u-3.1 marketstructure
Rai University670 views
Bsc agri 2 pae u-3 perfect-competition von Rai University
Bsc agri  2 pae  u-3 perfect-competitionBsc agri  2 pae  u-3 perfect-competition
Bsc agri 2 pae u-3 perfect-competition
Rai University781 views

Último

Use of Probiotics in Aquaculture.pptx von
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptxAKSHAY MANDAL
119 views15 Folien
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... von
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
88 views113 Folien
Relationship of psychology with other subjects. von
Relationship of psychology with other subjects.Relationship of psychology with other subjects.
Relationship of psychology with other subjects.palswagata2003
52 views16 Folien
Ch. 8 Political Party and Party System.pptx von
Ch. 8 Political Party and Party System.pptxCh. 8 Political Party and Party System.pptx
Ch. 8 Political Party and Party System.pptxRommel Regala
54 views11 Folien
unidad 3.pdf von
unidad 3.pdfunidad 3.pdf
unidad 3.pdfMarcosRodriguezUcedo
117 views38 Folien
Gross Anatomy of the Liver von
Gross Anatomy of the LiverGross Anatomy of the Liver
Gross Anatomy of the Liverobaje godwin sunday
61 views12 Folien

Último(20)

Use of Probiotics in Aquaculture.pptx von AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL119 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... von Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
Relationship of psychology with other subjects. von palswagata2003
Relationship of psychology with other subjects.Relationship of psychology with other subjects.
Relationship of psychology with other subjects.
palswagata200352 views
Ch. 8 Political Party and Party System.pptx von Rommel Regala
Ch. 8 Political Party and Party System.pptxCh. 8 Political Party and Party System.pptx
Ch. 8 Political Party and Party System.pptx
Rommel Regala54 views
The Accursed House by Émile Gaboriau von DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta223 views
Psychology KS4 von WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch98 views
Psychology KS5 von WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch119 views
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively von PECB
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks EffectivelyISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
PECB 623 views
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx von ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP386 views
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant... von Ms. Pooja Bhandare
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Ms. Pooja Bhandare133 views
Education and Diversity.pptx von DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar193 views

Bsc cs i pic u-1 introduction to c language

  • 1. Course: BSC CS Subject: Programming In C Language Unit-1 Introduction to C language
  • 2. Function OF Computer  Input -- Input devices enable us to get information into a computer. Some examples include a keyboard, mouse, microphone, scanner, or digital camera.  Storage -- There are two types of storage: temporary and long-term. RAM, or random access memory, is temporary, meaning it stores information as you use it, but it is being constantly erased and rewritten as you open and close files. Long-term storage holds information for as long as you want it. Hard drives, portable hard drives, floppy drives, flash drives, CD’s, and DVD’s are long term storage devices.  Processor -- A microprocessor controls the computers’ functions. It is smaller than a dime, but contains millions of transistors that perform millions of instructions per second. The microprocessor performs these instructions using a three-step process: fetch, decode and execute.  Output -- Information that has been processed is communicated back to the user in the form of words, sounds or pictures, and is delivered through printers, speakers, monitors or other output devices. Sometimes output is just written back to a storage dev
  • 3. Basic Building Block Of Computer Control Unit- this is the device or a part of computer responsible or performs such regulating functions.. Arithmetic Logic Unit- this is the part or a circuitry of the Microprocessor chip for arithmetic operations, proportional and related functions, and logical functions. Memory- this is a part of computer or a card or modules that inserted to the motherboard’s slot Input -The System Unit that the system of computer feeds or decode first the data before to display using the output devices of computer. Output Devices- this is refer to the devices of computer that have an ability to display the information or can produce a hardcopy of a document.
  • 7. What is UNIX?  UNIX is an operating system which was first developed in the 1960s, and has been under constant development ever since. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops.  UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment.  However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no windows interface available, for example, in a telnet session.
  • 8. Cont..  There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
  • 9. What is LINUX?  It is the software on a computer that enables applications and the computer operator to access the devices on the computer to perform desired functions.  Linux is developed collaboratively, meaning no one company is solely responsible for its development or ongoing support. Companies participating in the Linux economy share research and development costs with their partners and competitors
  • 10. Windows  The operating system gives the framework upon which all other services and applications run. The majority of home users use a Windows based machine. Most of today’s applications and games are designed to run solely on Microsoft systems.  Microsoft Windows is extremely popular in schools and colleges, many businesses also use Windows.  The oldest of all Microsoft’s operating systems is MS-DOS (Microsoft Disk Operating System). MS-DOS is a text-based operating system. Users have to type commands rather than use the more friendly graphical user interfaces (GUI’s)available today
  • 11. What is algorithm?  A method that can be used by a computer for the solution of a problem.  A sequence of computational steps that transform the input into the output.  The word ”algorithm” comes from the name of a Persian author, Abu Ja’far Mohammed ibn Musa al Khowarizmi (c. 825 A.D.), who wrote a textbook on mathematics.  An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem.
  • 12. Algorithm Write an algorithm and draw the flowchart for finding the average of two numbers Algorithm:  Input: two numbers x and y  Output: the average of x and y  Steps:  input x  input y  sum = x + y  average = sum /2  output average
  • 13. Introduction to flowcharts  A flowchart is a graphical representation of an algorithm.  • Start or end of the program  • Computational steps or processing function of a program   • Input or output operation   • Decision making and branching   • Connector or joining of two parts of program
  • 14. Introduction of ‘C’  Root of the morden language is ALGOL 1960. It’s first computer language to use a block structure.  It gave concept of structured programming.  In 1967, Martin Richards developed a language, BCPL (Basic Combined Programming Language)
  • 15.  In 1970,by Ken Thompson created a language called as ‘B’. It used to create early version of Unix.  In 1972,by Dennis Ritchie introduced new language called as ‘C’ .
  • 16. 1972 Traditional C Dennis Ritchie 1990 ANSI/ISO C ISO Committee 1978 K&R C Kernighan &Ritchie 1989 ANSI C ANSI Committee
  • 17. Features Of C  It is robust lang whose rich setup of built in functions and operator can be used to write any complex prog  Prog written in c are efficient due to severals variety of data types and powerful operators.  The c complier combines the capabilities of an assembly lang with the feature of high level language. Therefore it is well suited for writing both system software and business package.  There r only 32 keywords, severals standard functions r available which can be used for developing prog.  c is portable lang , this means that c programes written for one computer system can be run on another system, with little or no modification.  c lang is well suited for stuctured programming, this requires user to think of a problems in terms of function or modules or block. A collection of these modules make a program debugging and testing easier.  c language has its ability to extend itself. A c program is basically a collection of functions that are supported by the c library. We can contuniously add our own functions to the library with the avaibility of the large number of functions.  In india and abroad mostly people use c programming lang becoz it is easy to learn and understand
  • 18. Basic structure of C programming  To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are illustrated below.   Documentation section  Link section  Definition section  Global declaration section  main () Function section  {  Declaration part  Executable part    }  Subprogram section  Function 1  Function 2  …………..  …………..  Function n (User defined functions)
  • 19. Basic structure of ‘C’ Documentation Section It has set of comment lines(name of program, author details). What is Comment line??  To guide a programmer to write a note for function,operation,logic in between a program.  Non-executable statement.  Can’t be nested. e.g:- /* Hello /* abc */ Hi */ ERROR.
  • 20. Link Section It provides instructions to the compiler to link function from the system library. # include Directive:-  To access the functions which are stored in the library, it is necessary to tell the compiler , about the file to be accessed. Syntax:- #include<stdio.h>  stdio.h is header file.
  • 21. Definition Section  defines all symbolic constants.  #define instruction defines value to a symbolic constant.  #define:-  It is a preprocessor compiler directive, not a statement.  Therefore it should not end with a semicolon.  Generally written in uppercase.
  • 22. Global Declaration Section  Some variables that are used in more than on function, such variables (global variables) declared in the global declaration section.  It also declares all the user-defined function.
  • 23.  Every ‘C’ program must have one main() function section.  It contains two parts 1) Declaration part:  It declares all variables used in the executable part. 2) Executable part:  It has atleast one statement. Main() function section
  • 24. A simple C program: Printing a line of text #include <stdio.h> main() { printf(“hello, worldn”); } Program output: hello, world
  • 25. Executing a C program : Executing a C program involves a series of steps. They are,  Creating the program.  Compiling the program.  Linking the program with functions that are needed from the C library.  Executing the program.
  • 26. How to run a program?  There are two ways to run programs written in a high-level language.  The most common is to Compile the program  The other method is to pass the program through an interpreter.
  • 27. Compiler Why compiler is require ? As machine (a processor) can operate On binary code instruction only…..If we use higher level language then …For execution of the program we must Convert it to lower level / machine level Code.
  • 28. Means, A program that translates Source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions.
  • 29. Interpreter: which analyzes and executes each line of source code without looking at the entire program. Advantage of interpreter: It can execute a program immediately. Compilers require some time before an executable program emerges. But, However, programs produced by compilers Run much faster than the same programs executed by an interpreter.
  • 30. Compiler checks for syntax errors if any on success coverts ‘C source code into object code form which is nearer to machine…
  • 31. process of compiling and running a C program
  • 33. References: 1. Programming in C by yashwant kanitkar 2. ANSI C by E.balagurusamy- TMG publication 3. Computer programming and Utilization by sanjay shah Mahajan Publication 4. .www.cprogramming.com/books.html 5. en.wikipedia.org/wiki/C_(programming_language) 6. www.programmingsimplified.com/c-program-example 7. http://cm.bell-labs.com/cm/cs/who/dmr/chist.html 8. http://en.wikipedia.org/wiki/Comparison_of_programming_languages 9. http://en.wikipedia.org/wiki/List_of_C-based_programming_languages 10. http://en.wikipedia.org/wiki/C_(programming_language)