foreach in C++

a simple code..  no explanations!
// C++ program to demonstrate use of foreach
void func()
{
    int arr[] = {10, 20, 30, 40};
    int sum=0;
    for (int x : arr)// the foreach loop
        sum+=x;
    //sum will be 100 at this point.
}
.veenusNotes

Comments