Browse Source

refactoring of this_row() funct. by using pointer to string literals

master
T. Meissner 9 years ago
parent
commit
ead450fd8b
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      21st_century_c/boxes.c

+ 6
- 4
21st_century_c/boxes.c View File

@ -31,15 +31,17 @@ int main() {
void this_row(direction_s d) {
char s[] = ".*.\n";
char *c;
if(d.left) {
strlcpy(s, "*..\n", sizeof(s));
c = "*..";
} else if(d.right) {
strlcpy(s, "..*\n", sizeof(s));
c = "..*";
} else {
c = ".*.";
}
printf("%s", s);
printf("%s\n", c);
}


Loading…
Cancel
Save