void foo(char *p) { int i; int len = strlen(p); p = malloc(sizeof(char)*len+2); p[0] = \'1\'; for(i=1; i<len+1; i++)
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
typedef struct _PERSON { size_t age; unsigned char* name; }PERSON; int init(PERSON** person) { (* person) = (PERSON *) malloc(sizeof(struct _PERSON));
Im trying to create a linked list in c. The twist is that I want to allocate the memory for the list so that all the nodes are consecutively stored in memory.
I am doing some hacking with Doug Lea\'s malloc.c (under Linux x86_64), and I need to find the lowest allocated address and the address of the high end of the highest allocated chunk--in other words,
I\'m implementing a heap allocator (malloc), and I need to choose a magic number to check if a given pointer point to a data structure I allocated. It seems obvious to me that no magic number can be
I have a question about malloc behavior. There is 2 c file myTools.c and mainFile.c mainFile.c is => int main(){
How does one malloc an array of structs correctly if each struct contains an array of strings which vary in size?
I am somewhat confused by what happens when you call strtok on a char pointer in C. I know that it modifies the contents of the string, so if I call strtok on a variable named \'line\', its content wi
I wanted to try out TBB\'s scalable_allocator, but was confused when I had to replace some of my code.