Create table of data

I want to have a 4 × 4 data table and call the amount of each home. How do I do it?

An array perhaps?

<type> table [4][4];

(Replace by whatever datatype you need)

and call the amount of each home.

You need to explain this better. You can't call an array element. You can only call a function.

My code is as follows

int B[2][2]={{1,0},{1,0}};

int led1=2; int led2=3;

void setup() { // put your setup code here, to run once: pinMode(led1,OUTPUT); pinMode(led2,OUTPUT); }

void loop() { //put your main code here, to run repeatedly: if(B[1,1]=1){ digitalWrite(led1,HIGH); } if(B[2,1]=1){ digitalWrite(led2,HIGH); } } }

 int b[2],[2]={1,0},{1,0};

You have an array that is 1 dimensional, of length 2, called b, and one that is one dimensional, of length 2, with no name. How do you plan to refer to that second array?


You do not have an array called B. You do not put all the indices in one set of braces. You do not separate indices with commas. You do not compare things using =.

The compiler would have told you all of this.

In addition, don't ever use single capital letters for variable names. Those are reserved for the core and many are defined as macros so it can do some really weird stuff.