Here is the code for the printf() function:
In this program, we first define the printf() function, which takes a const char* argument named str. We then use a for loop to iterate over each character in the string pointed to by str, printing each character to the console using the putchar() function.
In the main() function, we call the printf() function twice with different strings as arguments. The output of this program will be:
Note that while this function is similar to the printf() function in the standard library, it does not support formatting options, such as %d or %s, and should not be used as a replacement for the standard printf() function in production code.
No comments:
Post a Comment
If you have any doubts, please let me know