Algoritma 7

Pertemuan tgl 3 Desember 2015

Modular Programming

advantage:

*Top-down designed with sub-goal

*Can be done by more than one programmer

*Easier to debug

-sub-program                  -sub-program

Main Program -sub-program

-sub program                   -sub-program

Best practice:

-High fan-in(frequently used)

-Low fan-out(more specific functionality)

-Self contained

Function in C is divided in 2 types:Library function and user defined

Function prototype:

-To ensure a function is known by the initiator/caller

-Compiler will validate the parameter

Identifier scoping

-Local identifier:Inside function

-Global Identifier:Outside function

Passing Parameter

-By-value:Sent to other is the value

-By location/By Reference:Sent to other module in the adress

Recursive defenition:Calls inside a certain function calling itself

Recursive function

-Base case:Return value (constant) without calling next reculsive call

-Reduction step:Sequence of input value converging to base case

 

Leave a Reply

Your email address will not be published. Required fields are marked *