1. scanf family
1. the prototype of the scanf family is as follows. The ellipsis in each prototype represents a variable-length pointer list. Values converted from input are stored one by one to the memory locations pointed to by these pointer parameters.
Int fscanf (File * stream, char const * format ,...);
Int scanf (char const * format ,...);
Int sscanf (char const * format ,...);
2. the above functions read characters from the input source and convert them according to the format code given by the format string.
3. Differences:
1> the Input Source of fscanf is the stream given as a parameter.
2> scanf reads data from standard input
3> sscanf reads characters from the string given by the first parameter.
3. When the formatting string ends or the read input does not match the type specified by the format string, the input is stopped.
4. In any case, the number of converted input values is returned as the return value of the function.
5. If the file has reached the end before any input value is converted, the function returns the constant value EOF.
Ii. printf family
1. the printf function family is used to create formatted output. This family has three functions: fprintf, printf, and sprintf.
2. Their prototype is as follows:
Int fprintf (File * stream, char const * format ,...);
Int printf (char const * format ,...);
Int Sprint (char * buffer, char const * format ,...);
3. printf formats the values in the parameter list based on the format code and other characters in the format parameter.
4. Differences:
1> Use printf to output the output results to the standard output.
2> Use fprintf to use any output stream.
3> sprintf stores the result as a string ending with NUL to the specified buffer rather than writing the result to the stream.
The return values of these three functions are the actual number of printed or stored characters.