I try to wrote code that read data from stdin: size_t bufSize = 1024; unsigned char *msg = NULL; size_t msgBytes = 0;
For an assignment, part of what I have to do involves the use of malloc and realloc. I first create a 2D array of chars, the dimensions being the number of lines and the number of characters. I then u
I am using realloc in every iteration of 开发者_StackOverflowa for loop that iterates more that 10000 times.
I have a few related questions about managing aligned memory blocks.Cross-platform answers would be ideal.However, as I\'m pretty sure a cross-platform solution does not exist, I\'m mainly interested
How does one malloc an array of structs correctly if each struct contains an array of strings which vary in size?
The idea is to read strings from standard input until EOF is reached (in this format \"string - string\"). Then, break the string into two strings and and save them to a 2d array. The array is dynamic
NOTE: I\'ve re written the original question to make it much more clear. I have a function called VcStatus readVcard( FILE *const vcf, Vcard **const cardp )
I allocate some memory with malloc - about 128 bytes. Later on, I call realloc with about 200 bytes, but it\'s returning null!
I don\'t exactly know how to explain this problem. It\'s extremely random. I\'ve got some code posted here: http://pastebin.com/d2vzas5S
One of my classmates sent me a code and asked what was wrong with it. It was something like this: #include <stdio.h>