What does this mean ?
int * function() { /* code */ } 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 .
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; } Source: https://ru.stackoverflow.com/questions/864600/
All Articles