标题:程序中途崩溃scanf()字符串的获取
取消只看楼主
Stubborn
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2017-6-26
结帖率:60%
 问题点数:0 回复次数:2 
程序中途崩溃scanf()字符串的获取
#include <stdio.h>

int main (void)
{
    char address, name;
   
    printf ("Please enter a address.\n");
    scanf ("%c", address);
    printf ("Please enter your name.\n");
    scanf ("%c", name);
    printf ("Your address is %c,your name is %c", address, name);
   
    return 0;
 }

结果:
搜索更多相关主题的帖子: 崩溃 scanf 获取 address name 
2017-06-29 17:55
Stubborn
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2017-6-26
得分:0 
#include <stdio.h>

int main (void)
{
    char address[40], name[40];
   
    printf ("Please enter a address.\n");
    scanf ("%s", address);
    printf ("Please enter your name.\n");
    scanf ("%s", name);
    printf ("Your address is %s,your name is %s", address, name);
   
    return 0;
 }
2017-06-29 18:04
Stubborn
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2017-6-26
得分:0 
回复 3楼 wp231957
谢谢 好久没看现在才看到
2017-07-19 16:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-479057-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.137441 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved