Examveda
Examveda

Which of the following correctly declares an array of 10 integers in C++ and initializes all elements to zero?

A. int arr[10] = {};

B. int arr[10]; for(int i = 0; i < 10; ++i) arr[i] = 0;

C. int arr[10] = {0};

D. int arr[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

Answer: Option C


Join The Discussion

Related Questions on Arrays and Strings in C plus plus