C, 78 70 67 bytes
f(i,j){for(;++i<27;puts(""))for(j=0;++j<27;putchar((i>j?i:j)+64));}
The code makes use of the following golfing techniques for C:
- omit basic includes (like
stdio.h
) - omit (return) types of functions and variables, making them default to
int
- use the ternary operator instead of if-else blocks
- use the ASCII code of a letter instead of its char representation (i.e.
65
instead of'A'
) - use
putchar
to output a single character - abuse main's argument listabuse main's argument list
- use
puts("")
to output a newlineuseputs("")
to output a newline
Also, the rule If it is a function, it must be runnable by only needing to add the function call to the bottom of the program.
does not forbid the function to be called with parameters (thanks to ABcDexter!).
An ungolfed version (without any warnings with gcc) would look like this:
#include <stdio.h>
#define MAX(x, y) (x>y ? x : y)
int main()
{
for(int i=0; i<26; i++)
{
for(int j=0; j<26; j++)
printf("%c", MAX(i, j) + 'A');
printf("\n");
}
return 0;
}