The "printf" project is a programming exercise that is commonly used in introductory computer science courses to help students learn the basics of the C programming language. The goal of the project is to create a function that can print formatted output to the console. The printf function is a powerful tool that can be used to display strings, numbers, and other data types in a variety of ways.
More detail
In the printf project, students are tasked with creating a simplified version of the printf function, which can handle a limited set of formatting options. The function takes a format string as input, which specifies how the output should be formatted, and a variable number of arguments, which contain the data to be printed. The function then processes the format string and outputs the formatted data to the console.
The printf project is a valuable learning experience for students, as it helps them develop their programming skills and gain a deeper understanding of how programming languages work. By completing the project, students learn about C syntax, string manipulation, memory allocation, and other important programming concepts.
- Language: C
- Editor: VIM 8.1.2269
- Compiler: gcc 9.3.0
- Wall -Werror -Wextra -pedantic -std=gnu89
- Style guidelines: Betty style
- No allowed to use global variable
- No more than 5 functions per file
- All files end with a new line
Specifier | Output |
---|---|
c |
character |
s |
string |
d or i |
Signed integer |
% |
% |
File | Description |
---|---|
README.md | this file |
_putchar.c | putchar function |
get_function.c | get_function function |
main.h | header file |
print_char.c | print_char function |
print_digit.c | print_digit function |
print_string.c | print_string function |
printf.c | main function |
man_3_printf | man page |
printf_flowchart.png | flowchart _printf |
To install execute in terminal git clone https://github.com/Innocentsax/printf
-
_printf functions examples:
-
_printf("Character:[%c]\n", 'H');
- Output: char: [H]
-
_printf("String:[%s]\n", "I am a string !");
- Output: string: [I am a string !]
-
_printf("decimal: [%d]\n", 10000);
- Output: decimal: [10000]
-
_printf("Percent: [%%]\n");
- Output: Percent: [%%]
All files were compiled on Ubuntu 14.04 LTS.
All programs and functions were compiled with gcc 4.8.4
using flags -Wall -Werror -Wextra and -pedantic
.
All files have been written in the Betty Style.