0

How to define a function with array output as well as array inputs?

Just write a tiny function to help me understand. Thanks.

23rd Mar 2019, 6:45 AM
Pankaj Mandal
Pankaj Mandal - avatar
3 Answers
0
Please be a bit more specific.
23rd Mar 2019, 6:47 AM
Mensch
Mensch - avatar
0
You can't return an array. You can only return a pointer to an array. So: int *f(int a[], int b[]);
23rd Mar 2019, 7:03 AM
Vlad Serbu
Vlad Serbu - avatar
0
Just create a function that takes an array and return another array, suppose you have to modify it or sort it Eg. int *sort(int *arr, int size) { // Some code here } Edit : however, when using an array in a function, the data of the array one modified will be permanent.
23rd Mar 2019, 7:30 AM
RZK 022
RZK 022 - avatar