+ 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...

31st May 2018, 8:47 AM
Sp Maurya
Sp Maurya - avatar
1 Odpowiedź
+ 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; }
31st May 2018, 10:51 AM
XiLef