arpsmack, thank you so much! It works greatly now.
Why is it necessary to release memory two times:
free(array[i]);
free(array);
I thought that free(array[0]) is the same as free(array).
Type: Posts; User: totalnewbie
arpsmack, thank you so much! It works greatly now.
Why is it necessary to release memory two times:
free(array[i]);
free(array);
I thought that free(array[0]) is the same as free(array).
That's the testing program:
int main(int argc, char ** argv) {
/* check save & load */
check_saveload(10);
// check_saveload(100);
I am getting the error: "glibc detected malloc(): memory corruption: 0xb7fd3008" when function int ** load_table(FILE * file, int size) starts under UNIX. It works nicely under Windows. Do you find...
I am getting the error: "glibc detected malloc(): memory corruption: 0xb7fd3008" when function int ** load_table(FILE * file, int size) starts under UNIX. It works nicely under Windows.
...
Ok, just tell me wheter I am riht or not.
1. If I make 10x10 table (dynamic array) then all of these memory cells are side by side and figuratively speaking the beginning of the memory cell number...
I have that example: http://www.daniweb.com/forums/thread52253.html but I cannot find anything like that about multidimensional array. I've been looking for multidimensional example but haven't...
That's the write:
fwrite(table[x],sizeof(int),size,fp);
fread(&nitems,sizeof(int),1,file);
returns the number of lines as I've read from different sites.
I don't know how fwrite and fread behaves with 2d arrays, how it distinguishes between x and y....
Hi! I've been looking for working code example that uses 2d arrays with fwrite and fread but haven't found any. So I tried to realize it myself but I cannot get it work. The goal is to make 2d array...
Ok, it seems to work now. Just want to know why there is no need to multiply amount by size in returnPointer() function as I did in the main function?
int main ( void )
{
char *q = NULL;
...
1. Do you mean variable 'save' by variable 'temp' as an example from called function?
2. I don't understand what you mean by that sentence. I cannot distinguish amount and size at the moment.
I cannot get it work.
The function returnPointer() returns pointer for every string I've inserted until it returns null value. I want to store all of these returned pointers in a dynamic array named...
These two programs (6.1. A Simple Stream Server, 6.2. A Simple Stream Client) don't compile under win xp by using Dev-C++ environment:...
Numbers are the reason for error. I cannot locate the exact place where this error stems from. All I can say is that I have to change something in C code. Although at the moment this code seems to me...
I've the following code written in C and it displays files (name and size) and directories (<dir> if it encounters directory which is not hidden or not link) but it's not able to pass testing...
4. I've been checking examples which at first use malloc and then realloc. That's why I used to think that it's not possible to use malloc and realloc separately.
5. I usually program in Java,...
What if I want to put these characters into multidimensional array?
Scrutinizing your code I cannot see where memory space checking takes place. The size of the memory is increased by 5 units
...
My goal is to implement a program which allocates some space to array and then reads user input and puts it into array. If it runs out of memory it reallocates the memory by certain amount and copies...
I try to learn malloc function and I have some problems. This program compiles nicely but it crashes after I have entered one line text and pressed enter. Array is the array where I try to allocate...