functions and arrays
-
I need to pass an array to a function. When the array is one dimensional it works. When I try to use two dimensions it doesn't work. What can I do to fix this? Steve Not all who wander are lost...
-
I need to pass an array to a function. When the array is one dimensional it works. When I try to use two dimensions it doesn't work. What can I do to fix this? Steve Not all who wander are lost...
You should pass the char** and not the char* Nish p.s. show some code too._
One little CD gone, Then two CDs gone, Then 5 more gone, For a total 7 gones, If I was a CD R, I'd wanna cry, Cause I'd be just a goner, For a nasty CD burner. [funny how frustration wakes up the poet in me]_
-
You should pass the char** and not the char* Nish p.s. show some code too._
One little CD gone, Then two CDs gone, Then 5 more gone, For a total 7 gones, If I was a CD R, I'd wanna cry, Cause I'd be just a goner, For a nasty CD burner. [funny how frustration wakes up the poet in me]_
Thanks. the function is as follows. (don't comment on the lack of use of language features. I am not allowed to use them on this project.) is there a way to do it without using char **? [code] void BuildBoard(char *arBoard[], int Rows, int Cols) { int inRows,inCols; char inChar; for(inRows = 0;inRows < Rows;inRows++) { for(inCols = 0;inCols < Cols;inCols++) { scanf("%c",&inChar); arBoard[inCols][inRows] = inChar; } } return; } [/code] Steve Not all who wander are lost...
-
Thanks. the function is as follows. (don't comment on the lack of use of language features. I am not allowed to use them on this project.) is there a way to do it without using char **? [code] void BuildBoard(char *arBoard[], int Rows, int Cols) { int inRows,inCols; char inChar; for(inRows = 0;inRows < Rows;inRows++) { for(inCols = 0;inCols < Cols;inCols++) { scanf("%c",&inChar); arBoard[inCols][inRows] = inChar; } } return; } [/code] Steve Not all who wander are lost...
And how are you calling the function? What are you passing as the first arg? Nish_
One little CD gone, Then two CDs gone, Then 5 more gone, For a total 7 gones, If I was a CD R, I'd wanna cry, Cause I'd be just a goner, For a nasty CD burner. [funny how frustration wakes up the poet in me]_
-
And how are you calling the function? What are you passing as the first arg? Nish_
One little CD gone, Then two CDs gone, Then 5 more gone, For a total 7 gones, If I was a CD R, I'd wanna cry, Cause I'd be just a goner, For a nasty CD burner. [funny how frustration wakes up the poet in me]_
int Rows, Cols;//I already have the vales for these char Board[100][50]; BuildBoard((char **)Board,Rows,Cols); I need to be able to do this without using the typecast and without making Board a char *. Thanks. Steve Not all who wander are lost...