dimanche 5 juillet 2020

How to intitlialize an array partially to some default value?

I have an array (say for ex., unsigned int arr[1000]).

I want to intilialize the elements of an array like this ..

arr = {4, 10, 34, 45, 6, 67, UINT_MAX, UINT_MAX .. 994 times}

That is until I assign some value, I want default value in the array to be UINT_MAX.

Is there any way to do this ?

Of course for loop is always there, but apart from that any other way.

Aucun commentaire:

Enregistrer un commentaire