printf

This is a discussion on printf within the C Programming forums, part of the General Programming Boards category; how do i go about writing my own printf function, so that i do not have to include
stdio.h...

>how do i go about writing my own printf function
You first learn how to write a function that takes a variable number of arguments, then you learn how to convert various supported types into strings and write those strings using a lower level function, putchar as one possible option. Then you learn how to process the formatting flags so that your printf will handle more complex formatting than just type conversion. Here's a quick and dirty example, it can be made to be more compact and elegant with a little effort: