DEV Community

s
s

Posted on

Answer:

return arr

In here you are returning the address of the first value in the array, this address points to a temporary value inside the stack frame of the function search.

try to pass arr as a parameter or using "static int arr[3]" in order to make the array not…

</p>
Enter fullscreen mode Exit fullscreen mode





Syntax for temp vs permanent array which is being passed bw functions IN C.

Question : can we write a MACRO for this?

foo.p[i] or ARRAY(TYPE, foo)" where stb does "TYPE *foo = NULL".
How about writing a macro that globally defines the type of array that we pass between functions? Can we use macro arguments for this purpose?
See https://gcc.gnu.org/onlinedocs/cpp/Macro-Arguments.html

Top comments (0)