Created
October 30, 2014 16:54
-
-
Save voldyman/d8eb65bf063548d1761d to your computer and use it in GitHub Desktop.
print rows of stars recursively
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
#include<stdio.h> | |
void print_char(char c, int num) | |
{ | |
if (num < 0) | |
return; | |
printf("%c", c); | |
print_char(c, --num); | |
} | |
void print_char_rows(char c, int num) | |
{ | |
if (num < 0) | |
return; | |
print_char(c, num); | |
printf("\n"); | |
print_char_rows(c, --num); | |
} | |
int main(void) | |
{ | |
print_char_rows('*', 6); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment