Last active
December 23, 2015 19:29
-
-
Save gsathya/6683551 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void print_array(int *array, int length) { | |
if (length == 0) { | |
return; | |
} | |
printf("["); | |
print_array_rec(array, length); | |
printf("]"); | |
return; | |
} | |
void print_array_rec(int *array, int length) { | |
if (length == 1) { | |
printf("%d", *array); | |
} | |
else { | |
printf("%d, ", *array); | |
print_array_rec(array + 1, length - 1); | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment