Alphabetic Pattern Pyramid I want to know if I can improve this program. Its goal is to print a pattern in a pyramid form, by first receiving a letter. The first row is always 'A', only. Then 'ABA', then 'ABCBA'. Increasing order, then decreasing.

#include &lt;stdio.h&gt;

int main(void)
{
    char alphabet[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char letter;

    printf("Enter an uppercase letter: ");
    scanf("%c", &amp;letter);

    letter -= 65;

    for (int row = 0; row &lt;= letter; row++)
    {
        for (int spaces = letter; spaces &gt; row; spaces--)
            printf(" ");

        for (char letter2 = 0; letter2 &lt;= row; letter2++)
            printf("%c", alphabet[letter2]);

        for (char letter3 = 0 + row; --letter3 &gt;= 0; )
            printf("%c", alphabet[letter3]);

        printf("\n");
    }
}
Instead of having a static array of chars You could just use ASCII values from 0x41 to 0x5A. If You still insist having a static array, please consider marking it as a const.

Leaving Your int main() without any return value --- sign of the bad taste, to say the least. Consider having some proper error codes or at least return 0 on proper exit.

Your index of chars (letter2, letter3) can't be negative, so why would You use int instead of uint_* or size_t? Same applies to row and spaces variables.

In case of single char, putchar() is way faster then printf("%c", character).