2 ways to print a half-pyramid
I like your version one better - in that you can break it up into even smaller pieces. Split out the printing of repeated characters:

void print_repeat(char c, int n) {
    while (n--) {
        printf("%c", c);
    }
}


So that printing a row just calls that twice:

void print_row(int row_num, int size) {
    print_repeat(' ', size - (row_num + 1));
    print_repeat('*', row_num + 1);
    printf("\n");
}


And printing the whole pyramid just calls that in a loop:

void print_pyramid(int size) {
    int i;
    for (i=0; i&lt;size; ++i) {
        print_row(i, size);
    }
}