putchar(char) writes the character to standard output and is usually provided by stdio.h .
How to write a character to standard output without using stdio.h or any other standard library file (i.e.: no #include : s is allowed)?
Or are different formulated, how can I implement my own putchar(char) with zero #include statements?
This is what I want to achieve:
void putchar(char c) { } int main() { putchar('H'); putchar('i'); putchar('!'); putchar('\n'); return 0; }
Explanations:
- Note: No
#include : s is allowed. Not even a single one :-) - The solution should not be portable (built-in assembler, therefore, OK), but it must be compiled using gcc under MacOS X.
Determining the correct answer:
- The working
putchar(char c) function. Nothing more, nothing less :-)
c macos
knorv
source share