Current main() below, which is working now, is used to modify the size & values of an input array, and to generate an output array.
int main()
{
    unsigned char input_text[] = {0x00, 0x01, 0x02 ....};
    int ilength = sizeof(input_text)/sizeof(input_text[0]);
    int *olength;
    olength = &ilength;
    unsigned char* output_text = (unsigned char*)malloc(sizeof(unsigned char)*(*olength));
    int option = 1;
    switch(option)
    {   // array size and some elements values will be changed below
     case 1:
        change_output_method_1(&output_text, input_text, ilength, olength);
        // void change_output_method_1(unsigned char** output, unsigned char* input, int inlen, int *olen);
    }
    return 0;
}
Now, I want to revise above main() as a call function named change( ), which reads input_text and option values from new main( ), and return output_text value to new main().
Of course, create another new main( ) to call change( ).
unsigned char* change(unsigned char input_text, int option)
{
    int ilen = sizeof(input_text)/sizeof(input_text[0]);
    (same as before)
    return output_text;
}
int main()
{
    int opt = 1;
    unsigned char input[] = {same};
    unsigned char output[] = change(input, opt);
    // IMPORTANT: output[] size is unknown before receiving the return value from change( )
}
I meet some errors when define char arrays because of pointer issues. How to revise the new code?
 
     
    