The logic used in the problem is quite simple and effective one. He has defined two functions
Code:
void bank(int hu,int ca)
and
Code:
void bank1(int hu,int ca)
which are recursively used for initial condition of Humans & Cannibals are equal or not.

Then it recursivly decrease (Movement from one bank to other) the humans and cannibals depending on the case as to who in what number on the bank.

Enjoy coding.