小编Gra*_*ard的帖子

C 程序不打印作为输入给出的字符串

我希望输出打印我们打印的数据。但它没有按预期工作,输出没有显示并且正在退出

#include <stdio.h>
    
int main() {
    char name[20], department[3], section[1];
    
    printf("enter the name of the student:");
    scanf("%s", name);
    
    printf("enter your department:");
    scanf("%s", department);
    
    printf("enter the section");
    scanf("%s", section);
    
    printf("Name:%s \n  Department:%s \n  Section: %s  ", name, department, section);
    
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c

0
推荐指数
1
解决办法
57
查看次数

标签 统计

c ×1