But we can accomplish that by following any of the below mentioned methods. How to Return an Array in a C++ Function - JournalDev You could change your function to return a char* but you would just crash again since you would return the address of a local variable. How can code return an array of characters in C? - Stack Overflow Return an Array From a Function in C++ | Delft Stack 1. Is the C++ function actually returning a char[] or a pointer to one? strchr is the function to use to locate a single character. Your function is returning a char. I want return this array in another array in a subclass. without knowing more) Jul 22 '05 # 2. However, you can return a pointer to array from function. Return multiple values from a function in C | Techie Delight Using Pointers As we mentioned earlier, returning a normal array from a function using pointers sometimes gives us unexpected results. c++ - Return a 2D array from a function | DaniWeb Note that you can't modify a string literal in C. The contents of that memory are undefined once it has been released and its data may or may not be valid. After using 'namespace', we invoked the main () function. PROGMEM is part of the pgmspace.h . how to return a char array from a function in C - Stack Overflow As i understand there is no such a chance to just write return array; i tried to make pointer, but i have some problems with my code. You cannot assign one to the other. [SOLVED] C - returning char array pointer - LinuxQuestions.org How to return a char array from a function in C Code Example But you seem intent on returning the contents of a char array, rather than . There are two ways to return an array indirectly from a function. c++ - Problems returning char array from function, value gets messed up ... Return array from function in C. C programming does not require the return to a function of a whole array as an argument. matlab unrecognized function or variable substr