+ 1
Friends... Is it possible to return an character array from a function and store in a char array variable in main()... in C++??
Please give easy and clear cut explainations...
1 ответ
+ 2
char* getArray (int size)
{
// Create a Dynamic Array and set it to the Charpointer Output.
char* output = new char [size];
return output;
}
int main ()
{
// Create new Charpointer;
char* Array;
// Set Charpointer to array from funktion with size 16;
Array = getArray (16);
// dont forget to delete the array
delete [] Array;
return 0;
}