Daniel Alzugaray

Authored Content

Authored Comments

Hi John, Clint,

I was to include a couple of examples there but I missed it. The kinds of examples I had in mind are the following:

1) Using only the print_char function provided, print the entire alphabet in lowercase.

```
#include

int print_char(char c)
{
return (write(1, &c, 1));
}
```
Result:
daniel@ubuntu:~/low_level_programming$ gcc -Wall -Wextra -Werror -pedantic 1-main.c 1-print_alphabet.c print_char.c
daniel@ubuntu:~/low_level_programming$ ./a.out
abcdefghijklmnopqrstuvwxyzdaniel@ubuntu:~/low_level_programming/$

2) Using only the print_char function provided, print a number of type `int` passed to it. You must handle all values for signed int types.

Result:
(for example, if you pass the number 1024 to your function)

daniel@ubuntu:~/low_level_programming$ gcc -Wall -Wextra -Werror -pedantic 2-print_number.c 2-main.c print_char.c
daniel@ubuntu:~/low_level_programming$ ./a.out | cat -e
1024daniel@ubuntu:~/low_level_programming$

(for these examples, you should put your main function in the corresponding N-main.c file, and call your function which resides in the N-name.c file)

Please note that the level of difficulty rises substantially going from example 1 to example 2. For example 2, please think about your strategy first, and code it after. Also, having the book referenced in the article should help if you are a beginner.

For more practice, check out the Algorithms section on Hackerrank ( https://www.hackerrank.com/domains/algorithms/warmup )