Selasa, 18 Desember 2018

Materi: Function dan Recursion(Recursive)

FUNCTION AND RECURSION(RECURSIVE)


Function: 
is a structure, grouping that contains a group of statements that will be carried out by the CPU if the name of the function is called to be executed, except for the main function


Function in C divided in two types :
Library function
User-defined function

Library function: is a standard function provided by C compiler. Those function described in the header files
Example: strcpy() in string.h
printf() in stdio.h

User-defined function: is self defined functions

Recursive: 
is a function call inside a certain function that call itself.







Materi: Pointers and Arrays

POINTERS AND ARRAYS


Pada materi ini saya mempelajari tentang Pointers dan Arrays


Pointers: 

Pointer is a variable that store the address of another variable
Syntax :
<type> *ptr_name;
Two operators mostly used in pointer : * (content of) and & (address of)
Example:
Initialize an integer pointer into a data variable:
int d, *ptr;
ptr = &d;

Arrays: 

Data saved in a certain structure to be accessed as a group or individually. Some variables saved using the same name distinguish by their index.

Array characteristics:
- Homogenous
- Random Access



Materi: Repetition

REPETITION


Pada topik ini, saya mempelajari tentang Program Control - Repetition yang terdiri dari 

- For
- While 
- Do-While 
- Break 
- Continue 

For:
for(exp1; exp2; exp3) statement;
or:
for(exp1; exp2; exp3){
statement1;
statement2;
…….
 }

exp1 :  initialization (Inisialisasi nilai)
exp2 :  conditional (Kondisi kapan dia bakal berhenti)
exp3 :  increment or decrement (menambah/mengurangi nilai)
exp1, exp2 and exp3 are optional


While: 

while (exp) statements;
or:
while(exp){
statement1;
statement2;
   …..
}


Do While: 

do{
    < statements >;
} while(exp);

Keep executing while exp is true 
exp evaluation done after executing the statement(s)

Break: 

ending loop (for, while and do-while)
end the switch operation

Continue: 
skip all the rest of statements (subsequent to the skip statement) inside a repetition, and continue normally to the next loop





Materi: Function dan Recursion(Recursive)

FUNCTION AND RECURSION(RECURSIVE) Function:  is a structure, grouping that contains a group of statements that will be carried out by t...