C语言程序按书上写,为什么运行不了

/* ex02-05.c */

#include <stdio.h>

#include <string.h>

int main (void)

{

char buffer[256];

printf( "Enter your name and press <Enter>:\n" );

gets ( buffer );

printf( "\nYour name has %d characters and spaces!",

strlen( buffer ) )

return 0

}

第1个回答  推荐于2017-10-03
你确定是按照书上写的?输出后面漏了一个分号= =。
下面的代码你试试
#include <stdio.h>

#include <string.h>

int main (void)

{

char buffer[256];

printf( "Enter your name and press <Enter>:\n" );

gets ( buffer );

printf( "\nYour name has %d characters and spaces!",

strlen( buffer ) );

}本回答被提问者采纳
第2个回答  2015-12-06
最后两行最后漏了两个分号追问

不行诶

追答

#include

#include

int main (void)

{

char buffer[256];

printf( "Enter your name and press :\n" );

gets ( buffer );

printf( "\nYour name has %d characters and spaces!",

strlen( buffer ) );

return 0;

}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网