+ 1

I can't understand. why 2nd is giving error citing that "begin is not defined in scope?"???

1st code int create_array[]{100,200,300,400,500}; int *arr{nullptr}; arr = create_array; for(int i{0} ; i<5 ; i++) cout << arr[i] << endl; 2nd code int create_array[]{100,200,300,400,500}; int *arr{nullptr}; arr = create_array; for(int n: arr) //while create_array in place of arr =>fine cout << n << endl;

27th May 2021, 10:33 AM
saurabh
saurabh - avatar
2 Réponses