#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char buffer[256];
printf ("enter you name and press <Enter>:\n ");
gets( buffer );
printf (buffer);
printf ( " \n your name has %d characters and spaces! \n \n ", strlen ( buffer ));
system("PAUSE");
return 0;
}
运行效果:

第1个 fgf 是自己输入
第2个 fgf 是系统使用printf (buffer )打印出来的
your name has 3 characters……. 中的数字3 使用%d打印出来的