Setting vallue of all cells to -1
#1

Hi I have array for example:

new arr[NUMBER][ENUM];

I want to have it like:
arr[0] = -1;
arr[1] = -1;

etc just want to inicialize it at declaration of variable if it is possible..

I want to set all cells to -1, how I can do that without loop? Ty.
Reply
#2

You can't do it without a loop, the only thing you can do is
arr[0] = -1;
arr[1] = -1;
arr[2] = -1;
arr[3] = -1;
... and so on
Reply
#3

I thought that it can work like new arr[NUMBER][ENUM] = {-1, ...} by some way like this but I can't remember.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)