How do I access the 0th dimension of an array? - page 2

 
whoowl #:
So I have a list of ticket numbers, I select their orders by ticket number and I collect their respective magic numbers.
How do I store that information in an array?
How do I build
Array[ticket][magic]?
Array[1100101][2200202]?

I now how to query/select orders and collect their data. I need the syntax for inserting that data into an array.
One way you could do it is like this:

Array[0][ticket]
Array[0][magic]

Another way would be to use a struct, but you don't want that...
 
whoowl #:

So I have a list of ticket numbers, I select their orders by ticket number and I collect their respective magic numbers.
How do I store that information in an array?
How do I build
Array[ticket][magic]?
Array[1100101][2200202]?

I've learned that Numbers[0] = 100110010; doesn't work.
What syntax would work?

Please read the following ...

C Multidimensional Arrays (2d and 3d Array)
  • www.programiz.com
In this tutorial, you will learn to work with multidimensional arrays (two-dimensional and three-dimensional arrays) in C programming with the help of examples.
 
Dominik Egert #:
One way you could do it is like this:

Array[0][ticket]
Array[0][magic]

Another way would be to use a struct, but you don't want that...
OK. So,
Array[0][0] = 111111;
Array[0][1] = 222222;

So ticket is 111111 and magic is 222222.

Is that right?

So the first [0] is a perpetual multidimensional symbolic buffer that must never be tampered with if we want to work with multidimensional arrays.

Is that correct? Doesn't sound correct at all to me. Doesn't explain how Array[2] could ever be possible.
 
whoowl #:
OK. So,
Array[0][0] = 111111;
Array[0][1] = 222222;

So ticket is 111111 and magic is 222222.

Is that right?

So the first [0] is a perpetual multidimensional symbolic buffer that must never be tampered with if we want to work with multidimensional arrays.

Is that correct? Doesn't sound correct at all to me. Doesn't explain how Array[2] could ever be possible.
Read my previous post please.

Only the last dimension has actually memory associated, other dimensions are simply multipliers. (Concepts for the human, not for the machine. The computer does not know or has only one dimension, always!)

Yes, your example is correct, that's how you do it. Assign the values to the array as you described it in your last post.
 
Dominik Egert #:
Read my previous post please.

Only the last dimension has actually memory associated, other dimensions are simply multipliers. (Concepts for the human, not for the machine. The computer does not know or has only one dimension, always!)

Yes, your example is correct, that's how you do it. Assign the values to the array as you described it in your last post.
Really? Then why

Array[0][0] = 111111;
Array[0][1] = 222222;

instead of

Array[0] = 111111;
Array[1] = 222222;
 
whoowl #:
Really? Then why

Array[0][0] = 111111;
Array[0][1] = 222222;

instead of

Array[0] = 111111;
Array[1] = 222222;
May I say: Because!!!

Please take a sheet of paper and draw it out, or use Excel and try it there....

I really tried to explain it as good as I could.

And I am sure my explanation, if followed, is actually good.

But maybe someone else has an idea how to convey this to you...

I give up.
EDIT:
Only the last dimension has memory associated. You cannot just drop a dimension, you initially defined, just because you feel like it.
 

An array is of a single type, it does not matter if it's 1D, 2D or 3D—it's ALWAYS a single type.

So if you want to store both "ticket numbers" and "magic numbers" then you can't use simply type arrays. You would need to use an array of a structure (a complex data-type)

Arrays of a structure are still arrays of a single type, but that type is no longer a simple data-type like "int" or "double", but a complex data type that stores multiple pieces of information.

However, such an array of a structure is even more complex. So, until you fully understand how a array of a simple data-type works, you will not be able to understand and implement complex types.

I gave you a link about Multi-dimentional arrays in C. Forget about what you are trying to achieve and first focus on learning about arrays in an "academic" fashion.

Once you full understand how that works, then you can evolve to arrays of structures. Examples of arrays of structures are, the MqlRates array returned by CopyRates, or the MqlTicks array returned by CopyTicks.

C Multidimensional Arrays (2d and 3d Array)
  • www.programiz.com
In this tutorial, you will learn to work with multidimensional arrays (two-dimensional and three-dimensional arrays) in C programming with the help of examples.
 
I have read every post on this thread again, and I am the opinion, it has been very well visualized and explained, as well as fed with good links to resources.

If you study all of that >carefully<, I am sure, you will understand.

People have really put in some energy to help you, I would say it is now up to you to understand what was given to you.

If you have questions, don't hesitate to come back >after< you have studied everything that was given to you on this thread.
 
Fernando Carreiro #:

An array is of a single type, it does not matter if it's 1D, 2D or 3D—it's ALWAYS a single type.

So if you want to store both "ticket numbers" and "magic numbers" then you can't use simply type arrays. You would need to use an array of a structure (a complex data-type)

Arrays of a structure are still arrays of a single type, but that type is no longer a simple data-type like "int" or "double", but a complex data type that stores multiple pieces of information.

However, such an array of a structure is even more complex. So, until you fully understand how a array of a simple data-type works, you will not be able to understand and implement complex types.

I gave you a link about Multi-dimentional arrays in C. Forget about what you are trying to achieve and first focus on learning about arrays in an "academic" fashion.

Once you full understand how that works, then you can evolve to arrays of structures. Examples of arrays of structures are, the MqlRates array returned by CopyRates, or the MqlTicks array returned by CopyTicks.

ticket and magic are both ulong, so it is actually possible to do it in such way. Isn't it?
 
Dominik Egert #: ticket and magic are both ulong, so it is actually possible to do it in such way. Isn't it?

Yes, they are the same underlying data-type, but they are not of the same "meaning". They are two different types even if implemented the same way.

I doubt the OP is trying to store "magic numbers" and "ticket numbers" all in the same bag without being able to differentiated between the two types.

The OP is most probably trying to classify the orders by their magic number, and identifying them by their ticket number. That requires either separate arrays, or an array of a structure.

Since the OP has not explained their intent, this may even turn out to be an X/Y problem, and the ideal solution may not even need 2D or 3D arrays.

In the end it may just need a 1D array of a structure. However, it will be good for the OP to first learn how arrays work.

Reason: