下面给出一个具体的例子,前一部分是采用了符合ANSI标准形式的代码,后一部分是采用了与UNIX System V兼容方式的代码。代码中加了一些注释,这里就不再解释了。该例子已经在VC/Windows NT4.0、CC/AIX4.3.2.0、GCC/Redhat Linux 6.0环境下编译并正常运行。
The printf function formats and prints a series of characters and values to the standard output stream, stdout.
The format argument consists of ordinary characters, escape sequences, and (if arguments follow format) format specifications. The ordinary characters and escape sequences are copied to stdout in order of their appearance.