I am learning C++ from Primer 5th edition and I am at Returning a Pointer to an Array. The declaration of this function is:
int (*func(int i))[10];
and it's expected to return a pointer to an array.
I wrote code that does this:
#include <iostream>
#include <string>
using namespace std;
int *func(){
static int a[]={1,2,3};
return a;
}
int main (){
int *p=func();
for(int i=0;i!=3;++i){
cout<<*(p+i);
}
}
And it is working. But I want to know the difference between what I made here and
int (*func(int i))[10];
How I can make this function call work, because in the book, there isn't any concrete example.