-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I'm currently helping a friend debug a program of his, which includes linked lists. His list structure is pretty simple:
typedef struct nodo{
int cantUnos;
char* numBin;
struct nodo* sig;
}Nodo;
We've got the following code snippet:
void insNodo(Nodo** lista, char* auxBin, int auxCantUnos){
…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hello,
I am playing around with multidimensional array of unequal second dimension size.
Lets assume that I need the following data structure:
[&ptr0]-[0][1][2][3][4][5][6][7][8][9]
[&ptr1]-[0][1][2]
[&ptr2]-[0][1][2][3][4]
int main()
{
int *a[3];
int *b;
int i;
a[0] = (int *)malloc(10…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I trying to allocate memory for 10 bytes
BYTE* tmp;
tmp = new BYTE[10];
//or tmp = (BYTE*)malloc(10*sizeof(BYTE));
But after new or malloc operation length of *tmp more than 10 (i.e. '\0' char not in 10 position in tmp array)
Why?
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi all,
I just started out with C and have very little knowledge about performance issues with malloc() and free(). My question is as such: if I were to call malloc() followed by free() in a while-loop that loops for, say, 20 times, would it run slower compared to if I were to call free() outside…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I am a beginner in C. While reading git's source code, I found this wrapper function around malloc.
void *xmalloc(size_t size)
{
void *ret = malloc(size);
if (!ret && !size)
ret = malloc(1);
if (!ret) {
release_pack_memory(size, -1);
ret = malloc(size);
…
>>> More