Does c++ allow returning an array from a function?

Thanks all,
Nate

No.

yes.

char * foo()
{
   static char array[] = "Hello World";
   return array;
}

int* foo1()
{
   static int array[20];
   return array;
}

no as an array.

yes as a pointer or object such as std::vector

yes.

char * foo()
{
   static char array[] = "Hello World";
   return array;
}

int* foo1()
{
   static int array[20];
   return array;
}

You should see this link
POST

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.