int arr[] = { 10, 20, 30, 40 }; for (int x : arr) { // Stuff with x // x will first have 10, then 20 and so on. }