gpt4 book ai didi

c - sscanf() 无效操作符

转载 作者:行者123 更新时间:2023-11-30 21:03:38 25 4
gpt4 key购买 nike

所以我尝试在 char *temp[512] 上运行 sscanf,但出现错误(错误:二进制 & 的操作数无效(有“char *”和“float”)。char *temp[512] 包含信息:弗伦 2014-5-20 19.90 14.15 19.91 2014-05-21 15.05 11.3 15.05

char dates[13];
char dates2[13];
char city[15];
float temp1, temp2, temp3, temp4, temp5, temp6;
sscanf(temp,"%s %s %f %f %f %s %f %f %f",
city, dates ,&temp1, &temp2, &temp3, dates2 &temp4, &temp5, &temp6);

最佳答案

如果 temp 定义为 char *temp[512] 那么它不是字符串,并且无法将其传递给 sscanf.它应该被定义为char temp[512]

关于c - sscanf() 无效操作符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23789652/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com