Ok i have a small problem where i have a function that generates an array of characters. However, if i try to return that array i get a mess of errors. I think that i need to use a pointer to do it however, all the examples i saw used integers and did not work for me. This project i am working on is over my head, but that is how i learned all my other programing languages so please understand that my errors may just be newbie errors. Thanks! ~p4plus2~
...and if it helps here is the function:
i know i could combine the separate for loops but i left em apart since its was for a debugging reason and will not be there in my final product.
This also may not be the best way that i can accomplish what i am doing, but i think it is probably a better learning experience to do it the long way, however feel free to suggest another way to do this so if i make a new version maybe i will try a method suggested.
Code:
char start_rubik(){
char cube[6][3][3];
char color[] = {'b', 'o', 'g', 'r', 'w', 'y'};
for(int i = 0; i != 6; i++){
for(int b = 0; b != 3; b++){
for(int a = 0; a !=3; a++){
cube[i][b][a] = color[i];
}
}
}
for(int i = 0; i != 6; i++){
for(int b = 0; b != 3; b++){
for(int a = 0; a !=3; a++){
std::cout << cube[i][b][a];
}
std::cout << "\n";
}
}
return cube; //this is that nasty array i can't figure out.
}
For anybody who didn't guess, this script (once combined with all its other functions) will be a rubiks cube command line.....as stupid of an idea as that is i think it is a great learning experiance