I'm Java programmer and I'm struggling with this simple stuff.
How can I return this multidimensional array? Does it have to return a ** pointer? How can I get it in ... |
If a 2d array is created int 2DRepresentation[mapWidth][mapHeight]; inside a function, what is the best way to return this?
how does the function return look?
Would it be preferred to rather create a ... |
I'm having issues with returning a multidimensional array. I create the array in a function and then modify it in another function. In the main function I want to print out ... |
First, I'll admit this is homework but it has been around six years since I last programmed in C and ever since I have been only programming in Python and Java. ... |
How to create a function which returns a string array? or a multidimensional char array?
For example, I want to return an array char paths[20][20] created in a function.
My latest try is
char ...
|
I messed around with this enough but I really don't get it.
Here is what I want to do: Take a 2D char array as an input in a function, change the ... |
A semi decent modern compiler should issue a diagnostic about that which begs the questions Are you using an old compiler or have you not switched on all warnings or did you ignore the warnings? If it is the final case then never ignore warnings, they are there for a reason and 99% of the time you can make your code ... |
|
Walter Roberson re: program that return an address of multi dimensional array In article <1139718471.229347.169300@f14g2000cwb.googlegroups .com>, ashu wrote:[color=blue] >look at code >#include >int *mult(void);[/color] That declares that mult is a function taking no arguments and returning a pointer to an int . [color=blue] >int main(void) >{ > int *ptr,i;[/color] That declares that ptr is a pointer to an int . ... |
|
|
Code: #include #include #define LENGTH 50 char *newSubstr(char *str, int index); char **explode(char *str, char seperator); int main(void) { FILE *handle, *db; char *filename, str[LENGTH]; printf("File: "); fgets(filename, 16, stdin); handle = fopen(filename, "rt"); db = fopen("database.txt", "rt"); while(fgets(str, LENGTH, handle) != NULL) { for(int i = 0; i < strlen(str); i++) { if(str[i] == ' ' && i ... |
|
struct node { int v; string val; } class g_lib { private: node ** test; public: g_lib(); node ** init(int r, int c); } ------------------------------------------------------ g_lib::g_lib() { this->test = this->init(5,5); } node ** g_lib::init(int r, int c) { i was using malloc to allocate memory but looks like i dont have the C in me. } |
|
Hello, disclaimer: this is not a homework assignment, but a personal project. I am trying to calculate a determinant of a matrix (2D array), so I have a minor() which returns a new 2D array by pointer, but evidently something is wrong. When I anchor a pointer to the 2D array and display the array through the pointer within the minor() ... |
hello everyone In my code I call a method which creates a 2d array. I need to know how to return that 2d array back to the function that called it? int *Heightmap1 = createArray(); This calls the method. I have no idea about pointers which I think I need to know about! any help would be greatly appriciated. Thanks Rory ... |
Hello DaniWeb! I'm trying to return an array of strings from a function but I'm not sure how to do so. I've done the prerequisite Googling and have found people on this discussion board recommending to return char** which, it is said, can then be converted back into 2d array notation. It is this conversion to and from char** which has ... |
|
|