注册 登录
编程论坛 C语言论坛

C语言入门,小问题求大神帮解答

Lucky2877 发布于 2021-08-17 21:00, 984 次点击
#include<stdio.h>
#define B "booboo"
#define X 10
int main(void)
{
    int age;
    int xp;
    char name[40];
    printf("Please enter your first name.");
    scanf_s("%s", name, 40);
    printf("All right ,%s,what's your age?",name);

      scanf_s("%d",& age);
    xp = age + X;
    printf("That's a %s! You must be at least %d.\n", B, xp);
    return 0;
}

第二个scanf_s怎么不运行了?刚试了%d 前面加了一个空格也不能纠正。大神求解答。
2 回复
#2
apull2021-08-17 21:11
&后面不要有空格。
#3
rjsp2021-08-17 22:36
问题要描述清楚,比如运行时你输入了什么?
我怀疑你输入的名字是由多个单词组成的。
1