#include <iostream>
using namespace std;
int main() {
int arr[10] = {};
for(auto element : arr)
{
cout<<element<<" ";
}
cout<<endl;
}
if i write int arr[10] = {}, the elements in arr are all 0. but if i just wrtie int arr[10], the elements in arr are random.
So i am confused about int arr[10] = {}, i just declare a array int arr[10], but i don't give it any value, just a {}.
1000instead, aside that sytax only way is to loop thru array and assign0to each element manually. Read more about arrays here=(but keep the{}) and try it again.int arr[10]{};0 0 0 0 0 0 0 0 0 0, the=is maybe useless, what's the reason?