Can someone explain a function that return an array in c

what’s the * in between a return type and a function name doing when declaring a function that return an array or pointer

int * func(){

}

What’s is the * doing in there or is it just conventional, I don’t think so because there must be a reason it is there, I just don’t want to know how to do it, I want to know why it’s there.

Does it mean a function pointer, I don’t think so, because a function pointer is not declare that way.

I need an explanation, anyone.

Whatever comes before the the function name is the return type, in this case it’s a int * ( a pointer to an int), so this function returns a pointer to an integer, or as you said an array of integers

2 Likes

Thanks jeff, I really appreciate. now I get it👍

1 Like