Click here to Skip to main content
15,890,336 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionComplex multidimensional array in C++ Pin
Vaclav_19-Jan-19 18:27
Vaclav_19-Jan-19 18:27 
AnswerRe: Complex multidimensional array in C++ Pin
Richard MacCutchan19-Jan-19 21:34
mveRichard MacCutchan19-Jan-19 21:34 
GeneralRe: Complex multidimensional array in C++ Pin
Daniel Pfeffer19-Jan-19 21:48
professionalDaniel Pfeffer19-Jan-19 21:48 
GeneralRe: Complex multidimensional array in C++ Pin
Richard MacCutchan19-Jan-19 22:14
mveRichard MacCutchan19-Jan-19 22:14 
GeneralRe: Complex multidimensional array in C++ Pin
Daniel Pfeffer19-Jan-19 22:17
professionalDaniel Pfeffer19-Jan-19 22:17 
GeneralRe: Complex multidimensional array in C++ Pin
Vaclav_20-Jan-19 4:39
Vaclav_20-Jan-19 4:39 
GeneralRe: Complex multidimensional array in C++ Pin
Richard MacCutchan20-Jan-19 5:06
mveRichard MacCutchan20-Jan-19 5:06 
GeneralRe: Complex multidimensional array in C++ Pin
Vaclav_20-Jan-19 7:15
Vaclav_20-Jan-19 7:15 
Here is my test code.
It is not very "dynamic" but will do for now.
I may add the "Command" as a first element in Data array to make sure they match.
Actually it would simplify things (a little ) - using just multidimensional array with first element being "Command".
But I like the struct for future....

Now I need to modify usage of Command /Data....


C++
#define COMMAND_ARRAY 16
	struct ILI9341 {
		int Command;    // ILI9341 commands
		int* Data;      // ILI9341 data
	} ILI9341Array[COMMAND_ARRAY];

	// define/ assign Command
	int index = 0;
	int dataIndex = 0;
	int DefineCommand[COMMAND_ARRAY] = { 0x0, 0x1, 0x4 };
	int DefineData[][10] = { { 1, 2, 3, 4 }, { 5, 6, 7 }, { 9, 10, 11, 12, 13,
			14 } };
	for (index = 0; index != 3; index++) {
		ILI9341Array[index].Command = DefineCommand[index];
#ifdef DEBUG
		cout << "ILI9341Array[" << dec << +index << "] Command 0x" << hex
				<< ILI9341Array[index].Command << endl;
#endif
		ILI9341Array[index].Data = DefineData[index];
#ifdef DEBUG
		do {
			cout << "ILI9341Array[" << dec << +index << "] Data[" << dec
					<< +dataIndex << "] 0x" << hex
					<< ILI9341Array[index].Data[dataIndex] << endl;

		} while (ILI9341Array[index].Data[++dataIndex]);
		dataIndex = 0;
#endif

	}

GeneralRe: Complex multidimensional array in C++ Pin
k505420-Jan-19 8:47
mvek505420-Jan-19 8:47 
GeneralRe: Complex multidimensional array in C++ Pin
k505420-Jan-19 8:52
mvek505420-Jan-19 8:52 
GeneralRe: Complex multidimensional array in C++ Pin
Vaclav_21-Jan-19 6:56
Vaclav_21-Jan-19 6:56 
GeneralRe: Complex multidimensional array in C++ Pin
Richard MacCutchan21-Jan-19 22:36
mveRichard MacCutchan21-Jan-19 22:36 
AnswerRe: Complex multidimensional array in C++ Pin
k505420-Jan-19 4:54
mvek505420-Jan-19 4:54 
GeneralRe: Complex multidimensional array in C++ Pin
Vaclav_20-Jan-19 10:13
Vaclav_20-Jan-19 10:13 
AnswerRe: Complex multidimensional array in C++ Pin
Stefan_Lang20-Jan-19 21:29
Stefan_Lang20-Jan-19 21:29 
Questionis there any relation object states control and encapsulation? Pin
nig3D19-Jan-19 8:05
nig3D19-Jan-19 8:05 
AnswerRe: is there any relation object states control and encapsulation? Pin
phil.o19-Jan-19 9:41
professionalphil.o19-Jan-19 9:41 
AnswerRe: is there any relation object states control and encapsulation? Pin
CPallini19-Jan-19 10:34
mveCPallini19-Jan-19 10:34 
JokeRe: is there any relation object states control and encapsulation? Pin
Peter_in_278019-Jan-19 10:51
professionalPeter_in_278019-Jan-19 10:51 
GeneralRe: is there any relation object states control and encapsulation? Pin
nig3D20-Jan-19 4:23
nig3D20-Jan-19 4:23 
GeneralRe: is there any relation object states control and encapsulation? Pin
Peter_in_278020-Jan-19 10:49
professionalPeter_in_278020-Jan-19 10:49 
GeneralRe: is there any relation object states control and encapsulation? Pin
nig3D27-Jan-19 10:25
nig3D27-Jan-19 10:25 
AnswerRe: is there any relation object states control and encapsulation? Pin
leon de boer19-Jan-19 18:47
leon de boer19-Jan-19 18:47 
QuestionWhat are the programmers' opinions about Plain English Programming? Pin
Quantum Robin18-Jan-19 8:04
Quantum Robin18-Jan-19 8:04 
QuestionRe: What are the programmers' opinions about Plain English Programming? Pin
David Crow18-Jan-19 16:21
David Crow18-Jan-19 16:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.