G'day all,
I know this has been discussed a lot, but I still cant find what I need. I am pretty new to C and still am getting my head around pointers, namely, pointers to multi-dimensional arrays.
I have looked at examples such as int a[2][3]; int (*p) = a when a is a 2D array, but what does the brackets do?
I am creating a program which has a 2D array as a variable and it needs to pass that array onto an external function to modify it.
My array is initilised like this:
unsigned int node[3][2]={ {PINB,PINC}, {0,0}, {0,0} };
I believe the best way to do this is through pointers but I don't know how to setup the prototype for my function that takes in the 2D array.
This is the function im passing it to and how I call it:
NodeToMIDI(node, i, pMIDIdata);
And this is its prototype: //where "node_pointer" is the 2D array arg.
void NodeToMIDI(unsigned int node_pointer, unsigned int node_select, unsigned int * MidiPacket);
Can someone please explain the syntax and logic behind how to do this. Some of the other threads I have looked at have syntax that is unknown to me. Such as int ** a for example.
Thank-you for any help! Andrew.