Question: How do i Write a C program called diamond.c that takes a single command line argument and prints a diamond with the size given by
Use a function called repeat that does the same as the bash function repeat that we used before. It must be declared like this:
void repeat(int n, char c) { ... } Instead of using printf to print characters, use putchar. For example: putchar('*').
Remember that character literals are surrounded by single quotes. Double quotes are for strings.
Here are some sample runs:
calvin 21:34:19 > ./diamond 0 * calvin 21:34:22 > ./diamond 1 * *** * calvin 21:34:25 > ./diamond 2 * *** ***** *** *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
