In the cpp array concept, We can initialize the array as follows:
int arr[10] = {0};
It will output all elements as 0
But why the following initialization also gives the same result as above ?:
int arr[10] = {};
Thanks
In the cpp array concept, We can initialize the array as follows:
int arr[10] = {0};
It will output all elements as 0
But why the following initialization also gives the same result as above ?:
int arr[10] = {};
Thanks
Yes both work in the same way. You can use either.
You can go through this article for more reference.