5
How the code works behind the function printf()
do C? I am aware of what this function does, I want to know how it does.
5
How the code works behind the function printf()
do C? I am aware of what this function does, I want to know how it does.
5
Each compiler can use as much code as they like in their library as long as they do everything specified. And most make the source code available, so the best thing is to look there. Some places:
If you have Visual Studio, you can see it on your computer:
C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src
Note that codes are usually bad to read as they seek to be optimized and not readable.
The function essentially makes a parse in string sent, prints normal characters and switches to specific functions when you have to replace a pattern with a value that will often have to be converted to string first. For printing depends on the operating system or even the hardware it is running on. You may need to write to a port or you may need to call an OS function, or you may need a more complex and specific solution.
Browser other questions tagged c c++ printf
You are not signed in. Login or sign up in order to post.
Good question. See this answer: http://stackoverflow.com/questions/4867229/code-for-printf-function-in-c
– cantoni
This in English, but gives a good explanation of the function: http://www.cplusplus.com/reference/cstdio/printf/
– Renan Noronha
Did any help you more? You need something to be improved?
– Maniero