A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Baklava in Cyclone page! Here, you'll find the source code for this program as well as a description of how the program works.
#include <stdio.h>
#include <string.h>
int main() {
char line[22];
// Tell compiler that pointer math is going to be done, and the result
// may not be null terminated
char *@fat @nozeroterm line_ptr = line;
for (int n = -10; n <= 10; n++) {
int num_spaces = (n >= 0) ? n : -n;
int num_stars = 21 - 2 * num_spaces;
// Write num_spaces " " to line
memset(line_ptr, ' ', num_spaces);
// Append num_stars "*" to line
memset(&line_ptr[num_spaces], '*', num_stars);
// Null terminate line
line_ptr[num_spaces + num_stars] = '\0';
printf("%s\n", line);
}
return 0;
}
Baklava in Cyclone was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.