Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从已创建的列表中拨打该号码? printf(“输入生日:天>”); scanf(“%02d”,&list[*员工人数].birth.day); 如果(编号>30 | |编号30 | | | list[*number\u of_employee].birth.day_C_List_If Statement_Pointers - Fatal编程技术网

如何从已创建的列表中拨打该号码? printf(“输入生日:天>”); scanf(“%02d”,&list[*员工人数].birth.day); 如果(编号>30 | |编号30 | | | list[*number\u of_employee].birth.day

如何从已创建的列表中拨打该号码? printf(“输入生日:天>”); scanf(“%02d”,&list[*员工人数].birth.day); 如果(编号>30 | |编号30 | | | list[*number\u of_employee].birth.day,c,list,if-statement,pointers,C,List,If Statement,Pointers,我的问题是变量“number”,我不知道如何用提供的列表替换它,以便它可以是布尔比较有效的数字 提前感谢您能更清楚地说明您的问题吗?您需要检查scanf()的返回值是否等于1。你有list[*number\u of_employee].birth.day如果转换成功,那么只要if(list[*number\u of_employee].birth.day>30 | | | list[*number\u of_employee].birth.day

我的问题是变量“number”,我不知道如何用提供的列表替换它,以便它可以是布尔比较有效的数字


提前感谢

您能更清楚地说明您的问题吗?您需要检查
scanf()
的返回值是否等于
1
。你有
list[*number\u of_employee].birth.day
如果转换成功,那么只要
if(list[*number\u of_employee].birth.day>30 | | | list[*number\u of_employee].birth.day<0}
@RohanBari我刚才扫描的号码,我想看看它是否在if语句的参数范围内。@DavidC.Rankin的评论是正确的答案。只需将代码中的
编号
替换为
列表[*员工编号].生日.日期
        printf("Enter birthday: day>");
        scanf(" %02d", &list[*number_of_employee].birthday.day);  
        if (number >30 || number < 0) {
            printf("Invalid day.\n");
        }