Skip to content

Instantly share code, notes, and snippets.

@whyrusleeping
Created November 14, 2013 17:54
Show Gist options
  • Save whyrusleeping/7471265 to your computer and use it in GitHub Desktop.
Save whyrusleeping/7471265 to your computer and use it in GitHub Desktop.
Lab 12 Solutions.
int recursive_sum(int num) {
int ones = num % 10;
if (num == 0 ) {
return 0;
}
return ones + recursive_sum(num / 10);
}
void reverse_string(char *start, char *end) {
char temp;
if (start >= end) {
return;
}
temp = *start;
*start = *end;
*end = temp;
reverse_string(start + 1, end - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment