Since you've sidestepped the command shell's conveniencies like being able to edit your input before sending it to the program, that functionality needs to be duplicated *within* your program. In this case that means recognizing and handling the any special characters that the shell normally handles for you:
#include <stdio.h> … Read More
> what is size_t in this??
size_t is a typedef representing the type returned by the sizeof operator. It's very often used as the type for array indices because the maximum value of size_t will never be less than the potential number of indices in any array.
> can't we … Read More
Also `printf()` is a very expensive way to output a single character. Better to use `putchar('*')` because it's made specifically to output a single character. Read More
> but why we don't use printf()?
Allow me to make an enlightening comparison from my own stdio library. The back end to putchar() is fputc(), which totals in at 22 lines of code. fputs() is built on top of fputc() and is all of 6 lines.
*The guts to … Read More
In slightly more detail:
get the character parameter
output the character to the screen
get the format string
parse and analyze the string (not trivial)
find out that there's a CHAR format specifier
call the char output subfunction (as opposed to integer, float, octal, etc...)
get the character … Read More