gpt4 book ai didi

c - 为什么 while 循环中 '*s-*t"的结果是 "67"?

转载 作者:行者123 更新时间:2023-11-30 21:34:23 26 4
gpt4 key购买 nike

请问我无法理解 while 循环,为什么循环显示 A 两次而不是一次

char *s,*t;
s="ABC";
t="AA";
do {printf("A");}
while(*s++==*t++);
printf("%d %d",*s-*t);

最佳答案

在你的代码中

printf("%d %d",*s-*t);

调用未定义的行为,因为您没有提供足够的参数来满足所提供的格式说明符。

关于c - 为什么 while 循环中 '*s-*t"的结果是 "67"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32591777/

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