Skip to content

Instantly share code, notes, and snippets.

@domiyanyue
Created April 25, 2020 18:05
Show Gist options
  • Save domiyanyue/080fa067e4d99baae45b10cab13ddbb8 to your computer and use it in GitHub Desktop.
Save domiyanyue/080fa067e4d99baae45b10cab13ddbb8 to your computer and use it in GitHub Desktop.
mutual recursion
bool is_even(int n);
bool is_odd(int n);
bool is_even(int n) {
if (n == 0)
return true;
else
return is_odd(n - 1);
}
bool is_odd(int n) {
if (n == 0)
return false;
else
return is_even(n - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment