How do i define a 2D array using malloc ? (lets say 10X20).
second, can i increase number of rows or cols without creating a new increased array and copying all data ...
Below is a part of a longer code where malloc'ing for a 2D array is done. Could anyone tell if this is correct? If I introduce static values, the code works ...
Hello I am making my CPU burn hell and crash everytime I run this program, so there is some error either an infite loop or I dont know what, but it is meant to just assign on the fly from user input the number of rows, cols, and then i just fill content and print to see I did alright, but ...
Hi guys, I seriously do not understand how to use malloc to create a two-dimensional array. I understand the concept of malloc and how you can use a pointer to basically create a 1-D array using it. The problem is, I do not understand this pointers to pointers stuff, I don't understand the syntax or how to get it to function ...
char*tab_veld[80 = {0}; // assuming lengte is the number of columns in each row for(y=0;y< 80; ++y){ tab_veld[y] = malloc(lengte); memset(tab_veld[y], ' ', lengte); // set each column in this row to a space } // I don't know what posvisser means so I can't tell you if the next two lines are right or wrong. But what you want to ...
A bit like this CODE #include #include #include /* we're going to make a char mystr[counter][6] array here */struct list { int counter; char (*mystr)[6]; /* a number of strings, max length of 5 (and a \0) */};void extend ( struct list *list ) { int newcounter = list->counter + 5; void *p ...
beezo (Programmer) 15 Oct 03 0:41 I have a function that fills a 2D array with verticies but i want the 2D array to be declared outside the function, where the size is unknown. so the function only manipulates the array.I don't know what parameter to pass in, or how to declare the function. Can someone have a read, and tell ...