if I want to return a array what will be the return type of the function
Return type of array
hello @prerak_semwal
it shuld be pointer type (int * , if array is have int values)
also u need to allocate the array dynamically ,becuase static array get destroyed once function call get back to calling function
…
yes…
there is no need of sending pointer of the array that is already passed to function.because whaterver changes u will make in passed array will autmatically reflected in original array.
if u have created any new array inside function and u want send it to calling function thn in that case u need to return base address of pointer
but I wanted to store the address of a by returning it to the dynamic array b in LINE 18 ?
u can, but its redundant.
u already have address of a in the main function.
so no need of receiveing it from the function.
try printing b and a both have same address
@aman212yadav
you misunderstood me…here I just wanted to know syntax and whether I can do this or not…I got you point and I agree with that too !
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.