문제

I haven't found any mention of this anywhere. There is a dereference operator in a function name like this:

char *func()
{
   //code
}

what is the purpose of that * operator?

도움이 되었습니까?

해결책

You are not actually dereferencing anything, the * is part of the return type. The compiler doesn't really care about where you place the *, so your code is equivalent to writing

char* func() { }

In other words it means that func() returns a char pointer.

다른 팁

This is not a dereference operator, applied to the function, but function, returning pointer to a char.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top