Help 2 Array problems

I have doubts on how to do these 2 programs. Someone could help me with it and it is not much trouble.

1.Reverse Array. Write a function that accepts two int arrays and the array's size arguments. The function should copy the first array into the second array, except that the element values from the first array should be copied in reverse order in the second array.

void reverseArray(int first[],int size,int second[])



2.Implements the bin2dec function that receives an array of 1's and 0's and returns the decimal number that represents(assume the digit in the index i of the array represents the power i of 2.)
For example, if A={1,0,1,1,0}then the funtion must return 3 because (1*2^0)+(1*2^1)+(0*2^2)+=1+2+0=3.

int bin2Dec (int A[],int size)
Last edited on
you should try to get started first before people try to help you, if you dont help yourself then how can people help you..

the first functions you will need to loop through the array. the easiest loop is the for loop.

1
2
3
4
5
6
7
void reverseArray(int first[],int size,int second[])
{
    for(int startLocation = 0, endLocation = size-1; startLocation <  *****; ****,*****)
    {
           *****=*****
    }
}

fill in the blank :v
Last edited on
Topic archived. No new replies allowed.