Q:

Why the function name start with * in objective C?

I am learning Objective C, there is a function:
NSArray *desktops = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES);

When I press command and click function NSSearchPathForDirectoriesInDomains, I see something looks like:
FOUNDATION_EXPORT NSArray<NSString *> *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde);

I don't understand why there is a * before the function name while when I use the function in main.m I don't put * in function name?

A:

Let's pick a slightly simpler signature that will hopefully be clearer:
NSArray *GetArray()

You can move the space and write this way:
NSArray* GetArray()

This is a function that returns a pointer to an array. The "*" is part of the type, not part of the name.
It might also be clearer if you think of it this way:
(NSArray *) GetArray()

or
NSArray * GetArray()

It's generally a matter of style which you choose. In one case you're emphasizing that the return type is an array, and this function returns a pointer to it. In another, you're emphasizing that the return type is a pointer to an array.

