Is there a way to have a C source file print to the screen without including <stdio.h>?
Here’s my situation: I was asked to programatically handle 1000 C source files that will each implements several numerical functions in C (these functions are supposed to work on data that is in memory, eithout any I/O). The origin of these source files in unclear, and hence, I’d like to make sure there will be no harm to my machine when I compile & run these source files.
Is there a way to find out if a C source file is potentially harmful? I thought of asking the developers to avoid any #include statements whatsoever, but I do need just printf — as I’d like them to include an output of their calculations within main().
Any ideas?
Sure, add the prototype for
printfat the top of your source file, as long as you’re linking to the CRT libraries you can use the function without includingstdio.hprintfprototype