Arrays - question about programming
Posted: Tue Feb 08, 2011 8:08 am
Hi
The question is about arrays. For example we have 2 arrays of int and depending on A and B values we work either with array1[10] or with array2[10].
I have procedure like this:
This is what i want to do:
How ?
The question is about arrays. For example we have 2 arrays of int and depending on A and B values we work either with array1[10] or with array2[10].
I have procedure like this:
- Code: Select all
void PROC(int A, int B)
{
if (A>B)
{ array1[0]=...;
.....
..... // other actions with array1[];
}
if (A<B)
{ array2[0]=...;
.....
..... // other actions with array2[];
}
}
This is what i want to do:
- Code: Select all
void PROC(int A, int B)
{
if (A>B) AAA=array1[10]; // can I do something like this?
if (A<B) AAA=array2[10];
{ AAA[0]=...;
.....
..... // other actions with AAA[];
}
How ?