What does this mean ?

int * function() { /* code */ } 

Closed due to the fact that the essence of the issue is not clear to the participants of VTT , Kromster , insolor , Eugene Krivenja , ThisMan Aug 7 '18 at 21:11 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • The preset for writing the function :) - Harry
  • function is a pointer? if so what does he indicate? - Malik
  • @Harry and you can not just write without (*)? - Malik
  • The function returns a pointer. For what? Write yourself in code ... - Harry
  • 2
    Possible duplicate question: Books and learning resources for C ++ - VTT

1 answer 1

This function returns a pointer to an int , if you write without an asterisk, then it will return just an int .

The difference is that the pointer is not a variable value, but a link to the memory area.

A simple example where a function returns a pointer:

 int *max (int *a, int *b) { if (*a > *b) return a; return b; } int main() { int a, b, *aptr = &a, *bptr = &b; *max(aptr, bptr) += 1; return 0; }