空格可以 当结束使用

时间:2015-11-12 21:27:29   收藏:0   阅读:238
#include <stdio.h>
#include <string.h>
#define PRAISE "what a super marvelous name! "

int main(void)
{
    char name[50];
    printf("what‘s your name?\n");
    scanf("%s",name);
    printf("hello,%s.%s\n",name,PRAISE);
    printf("you name of %d letters occupies %d memory calls.\n",
          strlen (name),sizeof (name));
    printf("the phrase of praise has %d letters",
          strlen (PRAISE));
    printf("and occupies %d memory cell.\n\n\n\n",sizeof PRAISE);
    printf("%s",name);
    return 0;
    
    
}

一开始以为哪输错了,后开试了一下才知道空格代表结束,还有 系统会自动补全字符

原文:http://www.cnblogs.com/zhanghuanqiao/p/4960044.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!