作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
为什么这是无效的
for( int i = 0, int x = 0; some condition; ++i, ++x )
这是
int i, x;
for( i = 0, x = 0; some condition; ++i, ++x )
谢谢
最佳答案
when you need to declare two variables of different types, it can't be done by one declaration
Hackety hack:
for (struct {int i; char c;} loop = {0, 'a'}; loop.i < 26; ++loop.i, ++loop.c)
{
std::cout << loop.c << '\n';
}
;-)
关于c++ - For循环中的多个计数器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2340073/
我是一名优秀的程序员,十分优秀!