1.

Solve : C++ return char array.?

Answer»

Hay fellas. Been a while.

Im working on a personal OOP project and ran into a road block. As the title SAYS I am TRYING to retrun a char array. However I am getting the error mesage, "RETURN value type does not match the function type."

Code: [Select]char Arr1()
{
char Arr[11][11] =
{
"#__#",
"#__#",
"#__#",
"#__#"
};
return Arr;
};
if you are intent on using a char array use POINTERS and void the function INSTEAD of char Arr1() or just use a string and return that, char arr is CQuote from: Boozu on November 11, 2010, 04:57:46 PM

Hay fellas. Been a while.

Im working on a personal OOP project and ran into a road block. As the title says I am trying to retrun a char array. However I am getting the error mesage, "return value type does not match the function type."

Code: [Select]char Arr1()
{
char Arr[11][11] =
{
"#__#",
"#__#",
"#__#",
"#__#"
};
return Arr;
};

return value should be char[][], If it's an oop project though you should return an array of CString[] pointers.



Discussion

No Comment Found