-6
我正在尋找的memset()用於C++,我發現了一些這樣的事代碼:在C擴展for循環++
#include <iostream>
#include <cstring>
int main()
{
int a[20];
std::memset(a, 0, sizeof a);
for (int ai : a) std::cout << ai;
}
我用於循環擴展的Java編寫,但從來沒有在C++。這段代碼運行良好。我想知道循環如何工作?以及如何在任何C++代碼中實現。
該回路循環。 – DimChtz
它們被稱爲[基於範圍的循環](http://en.cppreference.com/w/cpp/language/range-for),並且自C++ 11起可用。 – Ron
不理解。請你詳細說明或給出一個鏈接來研究這個? –