问题标签 [duffs-device]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
1979 浏览

c++ - for 循环在 switch case 之间拆分的行为

在玩代码时,我注意到一个奇怪的行为,我不知道如何解释背后的逻辑

我希望printf执行我们说的10时间。然后我看到它继续运行(想象 100000 而不是 10)并假设开发人员(VS)解释了内部printf for非常预期),因此输出是n每次进入switch.

但后来竟然j从来没有初始化过。

所以我的问题是为什么?这是未定义的行为吗?这不是所谓的标准代码吗?