nt_printf is a custom implementation of the standard printf function in C, designed to handle various format specifiers and print outputs to the console.
This is my first C project, the goal was to start learning the language.
| Project | nt_printf |
|---|---|
| Open | 2025-03-31 |
| Closed | 2025-06-30 22:31 CEST (UTC+2) |
- Supports the standard format specifiers:
%%- Literal percent sign (%)%c- Character%s- String%d- Decimal integer%i- Integer%u- Unsigned integer%x- Hexadecimal (lowercase) (unsigned integer)%X- Hexadecimal (uppercase) (unsigned integer)%p- Pointer address%o- Octal (unsigned integer)
-
Clone this repository:
git clone https://github.com/Ntalcme/nt_printf.git
-
Navigate into the project directory:
cd nt_printf -
Build the static library using
make:make
This will generate a static library file named libntprintf.a in the project directory.
-
Include the library in your project:
-
Copy the
libntprintf.afile to your project's directory or link it during compilation. -
Include the
nt_printf.hheader file in your C source files.
-
Example compilation in your project:
gcc your_program.c -I./path_to_nt_printf -L./path_to_nt_printf -lntprintf -o your_programWhere ./path_to_nt_printf is the path where you placed the libntprintf.a file.
Once you've linked the libntprintf.a library, you can use it just like the standard printf function. Include the nt_printf.h header and call nt_printf() with your desired format specifiers:
#include "nt_printf.h"
int main(void)
{
nt_printf("Hello, %s! Your score is %d.\n", "Ntalcme", 12);
nt_printf("Displaying percentage: %%\n");
return 0;
}This will print:
Hello, Ntalcme! Your score is 12.
Displaying percentage: %
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
-
Inspired by the original printf function in the C standard library.
-
Special thanks to Panda for teaching me !
-
Special thanks to the open-source community for inspiration !