array calculation with C++.

Hello everyone,

please i need to know how to perform mathematical operations with the
1d array and 2d array.

for example I have two arrays:

array1 [2][2]= {3, 8} and {1, 4}
array2 [2][2]= {5, 6} and {7, 6}

Q1) how should I identify variables?
Q2) is it should be the both arrays from same type?
or it could be like this a1[2][3]and a2 [3][4]??

Q3) how should be the code look like(C++ Borland)??

I really apreciate your help.

thanks
closed account (zb0S216C)
profprog wrote:
Q1) how should I identify variables? (sic)

By identify do you mean refer to each element with the sub-script operator? or something else?

profprog wrote:
Q2) is it should be the both arrays from same type? or it could be like this a1[2][3]and a2 [3][4]?? (sic)

Yes, the the two types should be the same unless you want implicit casts to be performed by your compiler. I don't get what you mean in the second part of the question, though.

profprog wrote:
Q3) how should be the code look like(C++ Borland)?? (sic)

Borland is old and may not be fully compliant with the standard. As a result, your compiler may reject any code code given by us. Update your compiler, then we'll talk.

Wazzak
Last edited on
Q3 - Get a different compiler. Seriously.

Our classic ANSI C/C++ compiler technology, the Borland. C++ 5.5 Compiler


For example, GCC - http://gcc.gnu.org/
Last edited on
thank you so much for help.

actually I can't update my compiler because we have to use this version exactly in my college.

about the type of array it should be the same type. I got it (the same in mathematic) when you have to multiplicate two arrays, it should be the same type. right?

by Q1 I mean is there a keyword to identify variable of array?
for example:

int x = 0 ; //identify variable x.
int y = 2 ; //identify variable y.
closed account (zb0S216C)
profprog wrote:
when you have to multiplicate two arrays, it should be the same type. right? (sic)

Yes. It makes more sense that way.

profprog wrote:
by Q1 I mean is there a keyword to identify variable of array?
for example:

int x = 0 ; //identify variable x.
int y = 2 ; //identify variable y. (sic)

I still don't know what you mean. Sorry.

Wazzak
alright, I asked my friend and he told me.


What I mean is this:

int myarray_1[5]= {1,5,9,4,8};

thank you so much
Topic archived. No new replies allowed.