Answer the question
In order to leave comments, you need to log in
How to assign a value to an array (c++)?
typedef byte tAbc[2][2];
typedef tAbc tAbcs[3][3];
tAbcs* Abc;
void .....
Abc = {{{0,1},{1,1},{1,0}},{{....},{....},{....} },{{....},{....},{....}}}
what is wrong, tell me
cannot convert '' to 'byte (*)[3][3][2][ 2] {aka unsigned char (*)[3][3][2][2]}' in assignment
Answer the question
In order to leave comments, you need to log in
int* p = 42;
. tAbcs Abc;
You are trying to assign values to a pointer
using aggregate initialization . Also, you have lost one dimension, which will lead to filling part of the array with zeros.
tAbcs Abc =
{
{ { { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } } },
{ { { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } } },
{ { { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 } } },
};
I know about the dimension, this is an example for describing my problem,
I know how to do it in pascal, but I also need to write it in c++, for Arduino.
type
tabc=array[1..2, 1..2] of byte;
tabcs=array[1..3,1..3] of tabc;
varabcs:^tabcs;
how to implement it in c++ and assign values to this array?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question