Selasa, 18 Desember 2018

FUNCTION AND RECURSION

A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions.
Ex : void check(){
      .....;
}

int check(int a,int b){
        ......;
        return ...;
}


Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.
Ex : 

void recursion(){
      recursion();
}

int recursion(int a, int b){
         recursion(a,b);   
         return ...;
}

Tidak ada komentar:

Posting Komentar