Hi all,

please correct me if i make a stupid statement....

I know/think i know its not possible to explicitly return an array within C. However i am undert the impression that it is possible to do so using pointers. Ive had a read of various tutorials but none of which really have helped me in what im trying to do.

Im trying to....

1. pass an array to a function,

2. manipulate the array data

3. return the array back to main

thats the simplest way i can describe it i think. I have provided the required sinpets from my main function and the function that i want to edit my array elements.


heres what ive tried......fairly certain its rubbish but what the hell... if some one could help me clear this one up id be very greatful

thanks

Baffa


Code:
void MixColumns(int *ptr[], int size){

int r[4];


r[0] = ptr[0]*2 + ptr[12] + ptr[8] + ptr[4]*3;

r[1] = 2*(ptr[4]) + ptr[0] + ptr[12] + 3*(ptr[8]);

r[2] = 2*(ptr[8]) + ptr[4] + ptr[0] + 3*(ptr[12]);

r[3] = 2*(ptr[12]) + ptr[8] +ptr[4] +3*(ptr[0]);


ptr[0] = r[0];

ptr[4] = r[1];

ptr[8] = r[2];

ptr[12] = r[3];


return ptr;

}

int main (){


int current_state[16];

int *ptr = current_state;

current_state = MixColumns(ptr, 16);

return 0;
}