0

I tried this:

int ([]foo)();
int[] foo();
int (foo[])();

But it didn't declare what I expected. Is it possible?

I don't mean declaring a function returning a pointer. I need to return exactly an array.

Rndp13
  • 1,094
  • 1
  • 21
  • 35
user3663882
  • 6,957
  • 10
  • 51
  • 92
  • What is the difference between a pointer and an array, for you ? – Telokis Jun 09 '15 at 11:00
  • You can't return an array, but you can return a reference to an array, or a `std::array`. What do you actually need this for? – TartanLlama Jun 09 '15 at 11:00
  • @Ninetainedo Well, it's the different type. It's not only for me, it's for all. The thing that there's the array-to-pointer conversion and arrays're adjusted to pointers when they're odr-used – user3663882 Jun 09 '15 at 12:40
  • I am really curious about your requirements because the array will be implicitly turned into a pointer. So what will it change, concretly ? – Telokis Jun 09 '15 at 13:11

1 Answers1

0

What you want to return from your function is actually a pointer to the first element in the array:

int* arr(int arr[]);

for more information look at this function.

Community
  • 1
  • 1
israel altar
  • 1,768
  • 1
  • 16
  • 24