of 59 /59
Copyrights© 2008 BVU Amplify DITM Programming and Problem solving through C Language Programming and Problem solving through C Language Page:1 INTRODUCTION INTRODUCTION TO TO PROGRAMMING PROGRAMMING Chapter 1

# INTRODUCTION TO PROGRAMMING

kateb

• View
31

0

Embed Size (px)

DESCRIPTION

Chapter 1. INTRODUCTION TO PROGRAMMING. ALGORITHM. An algorithm is defined as the finite set of steps to be followed in order to solve the given problem. Basically, it gives the set of instructions which must be followed while solving the problem. Example 1: - PowerPoint PPT Presentation

### Text of INTRODUCTION TO PROGRAMMING Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:1

INTRODUCTIONINTRODUCTION

TO TO

PROGRAMMINGPROGRAMMING

Chapter 1 Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:2

ALGORITHM

An An algorithmalgorithm is defined as the is defined as the finite setfinite set of steps to be followed in of steps to be followed in order to solve the given problem.order to solve the given problem.

Basically, it gives the set of Basically, it gives the set of instructionsinstructions which must be which must be followed while solving the problem.followed while solving the problem. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:3

Example 1:Example 1:

To find the To find the largestlargest of three numbers. of three numbers.

Algorithm:Algorithm:Step 1: Step 1: Read the three numbers, say A, B Read the three numbers, say A, B and C.and C.Step 2:Step 2: If (A>B) and (B<C) then If (A>B) and (B<C) then AA is the is the largest number, go to step 4.largest number, go to step 4.Step 3:Step 3: If (B>A) and (A>C) then If (B>A) and (A>C) then BB is the is the largest else largest else CC is the largest is the largest number.number.Step 4:Step 4: Stop. Stop. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:4

Example 2:Example 2:

To find the average score of a student, for To find the average score of a student, for the three test marks (i.e. three subject the three test marks (i.e. three subject scores).scores).

Algorithm:Algorithm:Step 1:Step 1: Read the three test scores, say T1, Read the three test scores, say T1, T2 and T3.T2 and T3.Step 2:Step 2: SUMSUM = T1+ T2+ T3. = T1+ T2+ T3.Step 3:Step 3: AVERAGEAVERAGE= SUM/3.= SUM/3.Step 4:Step 4: Display Display AverageAverageStep 5:Step 5: Stop. Stop. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:5

Example 3:Example 3:

To find the area of a circle.To find the area of a circle.

Algorithm:Algorithm:

Step 1:Step 1: Read the radius of the circle say r. Read the radius of the circle say r.Step 2:Step 2: AREAAREA = 3.14 * r * r. = 3.14 * r * r.Step 3:Step 3: Display Display AreaArea..Step 5:Step 5: Stop. Stop. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:6

Characteristics of an Algorithm

Input:Input: An algorithm must be provided with any number An algorithm must be provided with any number of input/data values.of input/data values.

Output:Output: As we go through the algorithm, step by step, As we go through the algorithm, step by step, processing statements will yield some result. This processing statements will yield some result. This enables us to verify the algorithm. Hence at least enables us to verify the algorithm. Hence at least one output must be produced.one output must be produced. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:7

Definiteness:Definiteness:

Each statement must be very much clear, Each statement must be very much clear, and distinct. This ensures that the and distinct. This ensures that the statements must be unambigious.statements must be unambigious.

Finiteness:Finiteness:

The algorithm must terminate after a finite The algorithm must terminate after a finite number of steps.number of steps. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:8

Let us illustrate this point with the help of an Let us illustrate this point with the help of an example.example.

Algorithm:Algorithm:

Step 1:Step 1: Let a = 10. Let a = 10.Step 2:Step 2: If (a>10) then go to step 5. If (a>10) then go to step 5.Step 3:Step 3: X = Y * Z. X = Y * Z.Step 4:Step 4: Print X and go to step 2. Print X and go to step 2.Step 5:Step 5: Stop. Stop. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:9

Let us not bother the purpose of above Let us not bother the purpose of above algorithm, but simply try to trace it. Here we algorithm, but simply try to trace it. Here we notice that in the algorithm, nowhere the notice that in the algorithm, nowhere the value of value of ‘a’‘a’ is is changedchanged, which happens to , which happens to be controlling the flow and hence never be controlling the flow and hence never terminates. Such statements must be terminates. Such statements must be avoided.avoided.

Effectiveness:Effectiveness: It must be possible in practice, to carry out It must be possible in practice, to carry out each step manually (using paper and each step manually (using paper and pencil).pencil). Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:10

Example 4Example 4

Algorithm for dividing two numbers.Algorithm for dividing two numbers.

Algorithm:Algorithm:

Step 1:Step 1: Read the two numbers say a, b. Read the two numbers say a, b.

Step 2:Step 2: c = a/b. c = a/b.

Step 3:Step 3: Print c. Print c.

Step 4:Step 4: Stop. Stop. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:11

Now what happens to this algorithm, if Now what happens to this algorithm, if value of value of bb is is 00? ?

Since the system doesn’t give you such Since the system doesn’t give you such answer, hence a care must be taken answer, hence a care must be taken while you write the algorithm. One way while you write the algorithm. One way is to provide an appropriate error is to provide an appropriate error message, like:message, like: Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:12

Modified AlgorithmModified Algorithm

Step 1:Step 1: Read the two numbers say a, b. Read the two numbers say a, b.

Step 2:Step 2: If (b = 0) then If (b = 0) then

print “denominator value is 0”print “denominator value is 0”

and go to step 5.and go to step 5.

Step 3:Step 3: c = a/ b c = a/ b

Step 4:Step 4: Print c Print c

Step 5:Step 5: Stop Stop Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:13

An algorithm can be expressed in many ways.An algorithm can be expressed in many ways.

One way is to express it in natural language One way is to express it in natural language (viz, English).(viz, English).

This way of representation helps to write a This way of representation helps to write a program in any language, as it needs only the program in any language, as it needs only the conversion to respective languages.conversion to respective languages.

Thus it appears more general. However, care Thus it appears more general. However, care must be taken in such case to avoid ambiguity. must be taken in such case to avoid ambiguity. Another way, is to represent algorithm Another way, is to represent algorithm graphically – graphically – a flowchart.a flowchart. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:14

1.1. First write the algorithm for a given First write the algorithm for a given problem as if we are solving problem on a problem as if we are solving problem on a paper.paper.

2.Convert each statement of the algorithm 2.Convert each statement of the algorithm into its equivalent program statements into its equivalent program statements and then think of putting the control and then think of putting the control statement.statement.

We can make use of We can make use of flowchartsflowcharts for the for the algorithm designalgorithm design..

Algorithm Design Tools Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:15

Given a list of five numbers Given a list of five numbers find the largest number in the find the largest number in the list.list.

Assignment Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:16

It is a It is a diagrammatic diagrammatic way of representing way of representing the steps to be followed for solving the given the steps to be followed for solving the given problem.problem.

The main advantage of flowchart is that The main advantage of flowchart is that since it is in the form of diagram one can since it is in the form of diagram one can understand the flow of code very easily. understand the flow of code very easily. While drawing the flowcharts we make use While drawing the flowcharts we make use of certain symbols. These are shown below:of certain symbols. These are shown below:

Flowchart Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:17

SymbolSymbol PurposePurpose

START/STOPSTART/STOP

AssignmentAssignment

Statements,Statements,

Expressions etc.Expressions etc.

Flowchart Notation used Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:18

SymbolSymbol PurposePurpose

Decision makingDecision making

ConnectorConnector

Flow indicationFlow indication

Flowchart Notation used Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:19

Example 1Example 1

Draw a flowchart to add two Draw a flowchart to add two numbers say ‘a’ and ‘b’. Store the numbers say ‘a’ and ‘b’. Store the result in sum. Display the Print result in sum. Display the Print “sum”.“sum”.

Examples on Flowcharts Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:20

Start

sum = a + b

Print the resultsum

Stop Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:21

Draw a flowchart to find the Draw a flowchart to find the factorial of a given number.factorial of a given number.

Example 2 Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:22

Start

Initialize, Fact = 1i = 1

Print “factorial of number is “fact”Stop

If number == 0

Yes

Print “ factorial for 0 is 1”

Stop

No

Fact = fact * i

i = i +1

If i<=number

Yes Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:23

Assignment

Draw a flow chart to search a Draw a flow chart to search a number from a given list of number from a given list of nn numbers.numbers. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:24

Pseudocode

PseudocodePseudocode generally does not generally does not actually obey the syntax rules of any actually obey the syntax rules of any particular languageparticular language

There is no systematic standard form, There is no systematic standard form, although any particular writer will although any particular writer will generally borrow style and syntax for generally borrow style and syntax for example control structures from some example control structures from some conventional programming language. conventional programming language. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:25

KEYWORDS

Several keywords are used to indicate Several keywords are used to indicate common input, output and processing common input, output and processing operations:operations:

OutputOutput: Print, Display, Show: Print, Display, Show

ComputeCompute: Compute, Calculate, Determine: Compute, Calculate, Determine

InitializeInitialize: Set, Init: Set, Init Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:26

Example 1

Draw the flowchart and also give the Draw the flowchart and also give the pseudocode to calculate the paypseudocode to calculate the pay

Start

Pay = hours * rate

End Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:27

Pseudocode

BeginBegin

input hoursinput hours

input rateinput rate

pay = hours * ratepay = hours * rate

print payprint pay

EndEnd Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:28

Assignments

Draw the flowchart and the Draw the flowchart and the pseudocode for the following pseudocode for the following problems:problems:

1.1.To find the sum of two numbers.To find the sum of two numbers.

2.To find the average of three numbers.2.To find the average of three numbers. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:29

IF-THEN-ELSE

Binary choiceBinary choice on a given Boolean condition is on a given Boolean condition is indicated by the use of four keywords: IF, THEN, indicated by the use of four keywords: IF, THEN, ELSE, and ENDIF. The general form is: ELSE, and ENDIF. The general form is:

IFIF condition condition THENTHEN

sequence 1sequence 1

ELSEELSE

sequence 2sequence 2

ENDIFENDIF

If the condition is If the condition is truetrue, , sequence 1sequence 1 is performed, is performed, otherwise otherwise sequence 2sequence 2 is performed. is performed. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:30

Example

Draw the flowchart and also give the Draw the flowchart and also give the pseudocode to calculate the pay with pseudocode to calculate the pay with overtimeovertime

Start

Pay = hours * rate

End

Is hours <= 40Yes

No

Pay = 40 * rate +(hours – 40) *1.5 * rate Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:31

BeginBegin input hours, rateinput hours, rate if hours <=40 thenif hours <=40 then pay = hours * ratepay = hours * rate else else pay = 40 * rate + (hours – pay = 40 * rate + (hours – rate) * 1.5 * raterate) * 1.5 * rate endifendif print payprint payEndEnd

Pseudocode Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:32

WHILE

The The WHILEWHILE is used to specify a is used to specify a looploop with a with a test at the top. The beginning and ending of test at the top. The beginning and ending of the loop are indicated by two keywords the loop are indicated by two keywords WHILEWHILE and and ENDWHILEENDWHILE. The general form . The general form isis

WHILEWHILE condition condition

sequencesequence

ENDWHILEENDWHILE Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:33

Draw the flowchart and also give the pseudocode Draw the flowchart and also give the pseudocode to find the average of 10 numbers.to find the average of 10 numbers.

Example

Start

sum = x + sumIncrement i

While i<=10

Yes

No

Avg = sum / 10

i=1, sum=0

Input x

Print avg

Stop Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:34

BeginBegin i=1i=1 sum=0sum=0 While i <=10While i <=10 input xinput x sum = sum + xsum = sum + x i = i + 1i = i + 1 end whileend while avg = sum/10avg = sum/10 print avgprint avgEndEnd

Pseudocode Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:35

A CASE construct indicates a A CASE construct indicates a multiwaymultiway branch branch based on conditions that are mutually exclusive. based on conditions that are mutually exclusive. Four keywords, CASE, OF, OTHERS, and ENDCASE, Four keywords, CASE, OF, OTHERS, and ENDCASE, and conditions are used to indicate the various and conditions are used to indicate the various alternatives. The general form is:alternatives. The general form is:

CASECASE expression expression OFOF condition 1 : sequence 1 condition 1 : sequence 1 condition 2 : sequence 2 condition 2 : sequence 2 ... ... condition n : sequence n condition n : sequence n OTHERS: OTHERS: default sequence default sequenceENDCASEENDCASE

CASE Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:36

Example

CASE  Title  OFCASE  Title  OF                Mr      : Print "Mister"                Mr      : Print "Mister"                Mrs     : Print "Missus"                Mrs     : Print "Missus"                Miss    : Print "Miss"                Miss    : Print "Miss"                Ms      : Print "Mizz"                Ms      : Print "Mizz"                Dr      : Print "Doctor"                Dr      : Print "Doctor"ENDCASEENDCASE

CASE  grade  OFCASE  grade  OF                A       : points = 4                A       : points = 4                B       : points = 3                B       : points = 3                C       : points = 2                C       : points = 2                D       : points = 1                D       : points = 1                F       : points = 0                F       : points = 0ENDCASEENDCASE Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:37

REPEAT-UNTIL

This loop is similar to the WHILE loop except This loop is similar to the WHILE loop except that the test is performed at the that the test is performed at the bottombottom of of the loop instead of at the top. Two the loop instead of at the top. Two keywords, keywords, REPEATREPEAT and and UNTILUNTIL are used. are used. The general form is: The general form is:

REPEATREPEAT

sequencesequence

UNTILUNTIL condition condition Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:38

FOR

This loop is a specialized construct for This loop is a specialized construct for iterating a specific number of times, often iterating a specific number of times, often called a “counting” loop. Two keywords, called a “counting” loop. Two keywords, FOR and ENDFOR are used. The general FOR and ENDFOR are used. The general form is:form is:

FORFOR iteration bounds iteration bounds

sequencesequence

ENDFORENDFOR Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:39

Example

Write a Pseudode to find the average of 10 Write a Pseudode to find the average of 10 numbers using FOR loop.numbers using FOR loop.

BeginBegin sum = 0sum = 0 for i = 1 to 10for i = 1 to 10 input xinput x sum = sum + xsum = sum + x end forend for avg = sum / 10avg = sum / 10 print avgprint avgEndEnd Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:40

Computers being Computers being electronic brainselectronic brains or having or having artificial intelligenceartificial intelligence, it is still necessary for , it is still necessary for humans to convey this sequence of instructions humans to convey this sequence of instructions to the computer before the computer can to the computer before the computer can perform the task.perform the task.

ProgrammingProgramming means designing or creating a means designing or creating a set of instructions to ask the computer to carry set of instructions to ask the computer to carry out certain jobs which normally are very much out certain jobs which normally are very much fasterfaster than than human beingshuman beings can do. can do.

In order to do programming, we need to use In order to do programming, we need to use certain certain computer languagecomputer language to communicate to communicate with the computer. with the computer.

Programming Languages Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:41

There are many computer languages out There are many computer languages out there, some of the examples are C, Visual there, some of the examples are C, Visual Basic, Fortran, Cobol, Java, C++, Turbo Basic, Fortran, Cobol, Java, C++, Turbo Pascal, Assembly language and etc.Pascal, Assembly language and etc.

The set of instructions and the order in The set of instructions and the order in which they have to be performed is which they have to be performed is known as an known as an algorithmalgorithm.. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:42

The result of expressing the The result of expressing the algorithm in a programming language algorithm in a programming language is called a is called a programprogram. .

The process of writing the algorithm The process of writing the algorithm using a programming language is using a programming language is called called programmingprogramming, and the , and the person doing this is the person doing this is the programmerprogrammer. . Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:43

Storage

Holds the data that the computer Holds the data that the computer will process and the will process and the instructionsinstructions that indicate what processing is to that indicate what processing is to be done.be done.

In a In a digital computerdigital computer, these are , these are stored in a form known as stored in a form known as binarybinary, , which means that each instruction which means that each instruction is represented by a series of is represented by a series of bitsbits. . Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:44

Bits are conceptually combined Bits are conceptually combined into larger units called into larger units called bytesbytes (usually 8 bits each) and (usually 8 bits each) and wordswords (usually 8 to 64 bits each). (usually 8 to 64 bits each).

Types of Storage deviceTypes of Storage device1.1. RegistersRegisters2.2. Main memoryMain memory3.3. Secondary storage.Secondary storage. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:45

RegistersRegisters Registers are the fastest and most Registers are the fastest and most

costly storage units in a computer.costly storage units in a computer.

Normally contained within the Normally contained within the processing unitprocessing unit

Registers hold Registers hold datadata that are involved that are involved with the computation currently being with the computation currently being performed.performed. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:46

Main MemoryMain Memory Computer Memory is the internal storage Computer Memory is the internal storage

areas in the computer.areas in the computer. It comes in the form of chips capable of It comes in the form of chips capable of

holding data.holding data.

Two Types of MemoryTwo Types of Memory1.1. ROM (Read Only Memory)ROM (Read Only Memory)2.2. RAM (Random Access Memory)RAM (Random Access Memory) Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:47

Date is prerecorded for read only, Date is prerecorded for read only, which cannot be removed.which cannot be removed.

ROM is non-volatile.ROM is non-volatile.

Store critical programs such as the Store critical programs such as the program that boots the computer.program that boots the computer. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:48

RAM (RANDOM ACCESS MEMORY)

Date can be read, write and remove Date can be read, write and remove in any order.in any order.

RAM is volatile.RAM is volatile.

CachingA small, fast memory system contains the most frequently used words from a slower, larger main memory. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:49

Secondary storage is the slowest, Secondary storage is the slowest, lowest-cost, and highest-capacity lowest-cost, and highest-capacity computer storage area. computer storage area.

Programs and data are kept in Programs and data are kept in secondary memory when not in secondary memory when not in immediate use, so that secondary immediate use, so that secondary memory is essentially a long-term memory is essentially a long-term storage medium. storage medium.

Secondary Storage Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:50

For the first machines in the 1940s, For the first machines in the 1940s, programmers had no choice but to write programmers had no choice but to write in the sequences of digits that the in the sequences of digits that the computer executed.computer executed.

Machine language is a collection of Machine language is a collection of binarybinary digits or bits that the computer digits or bits that the computer reads and interprets. Machine language reads and interprets. Machine language is the only language a computer is is the only language a computer is capable of understanding. capable of understanding.

Machine Language Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:51

Assembly Language

Since each component of a program stands for Since each component of a program stands for an object that the programmer understands, an object that the programmer understands, using its using its namename rather than rather than numbersnumbers should should make it easier to program.make it easier to program.

By naming all locations with easy-to-remember By naming all locations with easy-to-remember names, and by using symbolic names for names, and by using symbolic names for machine instructions, some of the difficulties of machine instructions, some of the difficulties of machine programming can be eliminated.machine programming can be eliminated.

A relatively simple program called an A relatively simple program called an assemblerassembler converts this symbolic notation into converts this symbolic notation into an equivalent machine language program.an equivalent machine language program. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:52

High Level Language

High Level Languages (HLL)High Level Languages (HLL) use words similar to use words similar to English and are easier to write. English and are easier to write.

The first programming languages were developed in the The first programming languages were developed in the late 1950s. late 1950s.

If we want to compute |If we want to compute |AA + + BB − − CC|, and store the result |, and store the result in a memory location called in a memory location called DD, all we had to do was , all we had to do was write write DD = | = |AA + + BB − − CC| and let a computer program, the | and let a computer program, the compilercompiler, convert that into the sequences of numbers , convert that into the sequences of numbers that the computer could execute. that the computer could execute. FORTRANFORTRAN (an (an acronym for Formula Translation) was the first major acronym for Formula Translation) was the first major language in this period.language in this period. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:53

Developing a program in a compiled Developing a program in a compiled language such as C requires at least four language such as C requires at least four steps:steps:

editingediting (or writing) the program (or writing) the program compilingcompiling it it linkinglinking it it executingexecuting it it Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:54

Editing

Write a computer program with words and Write a computer program with words and symbols that are understandable to human symbols that are understandable to human beings.beings.

This is the This is the editing partediting part of the development of the development cycle.cycle.

Type the program directly into a window on Type the program directly into a window on the screen and save the resulting text as a the screen and save the resulting text as a separate file often called as separate file often called as source filesource file..

Example:Example: The text of a The text of a C programC program is stored is stored with the extension with the extension .C.C.. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:55

Compiling

Cannot execute the source code directly.Cannot execute the source code directly.

Source file must be translated into binary Source file must be translated into binary numbers understandable to the numbers understandable to the computer.computer.

Compiler converts the source file (Compiler converts the source file (.c.c for for C) into an object file with the C) into an object file with the extension extension .obj.obj.. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:56

Many languages come with library routines Many languages come with library routines which can be added to your program.which can be added to your program.

These routines are written by the manufacturer These routines are written by the manufacturer of the compiler to perform a variety of tasks. So of the compiler to perform a variety of tasks. So these routines need to be added to your these routines need to be added to your program.program.

So the linker will convert the file with the So the linker will convert the file with the extension extension .obj.obj to a file with the extension to a file with the extension .exe.exe (executable file).(executable file). Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:57

Executable File

Editor produces Editor produces .c.c sources files. sources files.

The C source file are taken by the complier, The C source file are taken by the complier, which will convert to a file with the which will convert to a file with the extension extension .obj.obj..

The object file will be taken by the linker, which The object file will be taken by the linker, which will convert a file with extension will convert a file with extension .obj.obj to a file to a file with extension with extension .exe.exe..

Now you can run Now you can run .exe.exe files simply by typing files simply by typing their names.their names. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:58

LoaderLoaderCopying a program image from Copying a program image from hard diskhard disk to the to the main memorymain memory in order to put the in order to put the program in a ready-to-run state.program in a ready-to-run state.

TestingTestingTesting means finding all possible Testing means finding all possible bugsbugs. . The program should be tested against all The program should be tested against all possible possible inputsinputs.. Programming and Problem solving through C LanguageProgramming and Problem solving through C Language

Page:59

DebuggingDebugging Debugging is the process of Debugging is the process of analyzinganalyzing

and and locatinglocating the bugs when software the bugs when software does not behave as expected.does not behave as expected.

DocumentationDocumentation Write a brief and accurate Write a brief and accurate commentscomments at at

the beginning of each function.the beginning of each function. It becomes easy for other people It becomes easy for other people

unfamiliarunfamiliar with the working of the with the working of the program.program. ##### Introduction to R Programming - users.metu.edu.trusers.metu.edu.tr/ozancan/intro1.pdf · Introduction to R Programming Edited by Ozancan Ozdemir Contents Introduction to R Programming
Documents ##### Introduction to Java - University of Bridgeportdichter/cs410/Introduction to Java.pdf · Introduction to Java Programming Procedural Programming – also called imperative programming,
Documents ##### Unit 091 Introduction to GUI Programming Introduction to User Interfaces Introduction to GUI Programming GUI Design Issues GUI Programming Issues Java
Documents ##### Introduction to C++ Systems Programming. Systems Programming: Introduction to C++ 2 Systems Programming: 2 Introduction to C++ Syntax differences between
Documents ##### Introduction to Modern Scientific Programming · Introduction to Modern Scientiﬁc Programming Introduction to Modern Scientiﬁc Programming Dr. Markus Kirkilionis, Martin Eigel,
Documents ##### Introduction to Python Programming Introduction to Object … · Introduction to Python Programming Introduction to Object-Oriented Programming Annemarie Friedrich ([email protected])
Documents ##### Introduction to Python Programming Introduction to … · Introduction to Python Programming Introduction to Object-Oriented Programming Annemarie Friedrich ([email protected])
Documents ##### Introduction to Oracle 11g SQL Programming - … · Introduction to Oracle 11g SQL Programming Contents Chapter 1 - Course Introduction ... Introduction to Oracle 11g SQL Programming
Documents ##### Introduction to Programming Using C Introduction to Computer Programming
Documents ##### Introduction to Visual Basic Programming Chapter 3 – Introduction to Visual Basic Programming
Documents ##### Microcontroller Programming LMP1: Introduction to ...data.mecheng.adelaide.edu.au/robotics/ · Microcontroller Programming LMP1: Introduction to ... Example based introduction to
Documents ##### Introduction to programming - wiki.juneday.sewiki.juneday.se/mediawiki/images/1/11/Introduction_to_programming... · Introduction to programming Video lecture - Introduction to programming
Documents ##### Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming
Documents ##### Introduction to Programming & 2 Student registration & introduction to the module Introduction to programming methodology Programming language levels Factors to consider while selecting
Documents ##### UNIT INTRODUCTION TO PROGRAMMING THROUGH APP INVENTOR - Introduction to... · unit 0 – introduction to programming through app inventor unit 0 – introduction to programming through
Documents Documents