Functions in headers...

I am really curios that when i go to the declaration of some functions in C++/C
i only see their function prototypes and only some have full functions, i am curios are there any files that contain the original function? for example printf...
in stdio.h there is
_Check_return_opt_ _CRTIMP int __cdecl printf(_In_z_ _Printf_format_string_ const char * _Format, ...);

thats the prototype so where is the original printf stored in? and other functions..
Last edited on
the definition of printf is in the source code of your C library. For GNU, for example, it is;a=blob_plain;f=stdio-common/printf.c;hb=HEAD
The compiled code for printf is stored in the standard C library which is automatically linked into your program by the linker. The name and location depend on which compiler you're using.

The source code for the functions is usually not included with the compiler.

Can i access that on my machine? i am using visual studio
Can i access that on my machine?
Yes, you just need the right #include , the rest is done by the linker (for any machine)

only if you have a non standard library you need additional files
> Can i access that on my machine? i am using visual studio

Yes. Look for the file printf.c in <Visual Studio Install directory>\VC\crt\src
Last edited on
JLBorges oh yes thats what i was looking thank you
Topic archived. No new replies allowed.