What is the use of - int * return size, mostly seen in C in leetcode problems.
Please help me as there are no C submissions for this problem.
Problem is very simple - Sort Array.
But I don’t know how to use "returnsize ".
In C, an array variable is basically a pointer to the first memory location of the array. So suppose you have int a. Now *a refers to a. So, suppose you have to return an array, you return the pointer to the first memory location. I suggest you read about Pointers from web or books. https://www.tutorialspoint.com/cplusplus/cpp_pointer_to_an_array.htm can help understand the leetcode thing atleast clearly.
I have attached a link of my solution. Its not getting accepted because I dont know how to use “returnSize” which is passed as a parameter to function.
I have malloced array and returned pointer to this array.
In C, when you return a dynamically allocated array, it has no idea how long your array is. Therefore, you need to also return the array’s size. That’s why there is a parameter returnSize passed in so that you can assign the array’s size to it.