I'm having a hard time understanding this statement here:
for( int i=0; i< out_length; i++){
int num=i < length_a ? array_a[i] : 0;
...
...
what I googled:
expr1 ? expr2 : expr3
If expr1 evaluates to a non-zero value, expr2 is evaluated, otherwise expr3 is evaluated. The value of the expression as a whole is which ever of expr2 or expr3 is evaluated (this means the type of expr2 and expr3 must be the same).
but I'm still confused, it will be helpful if you can turn that statement into some if-else blocks, thanks for the help..