BlueBear icon

mallocimplement.c

BlueBear | PRO | 10/17/12 09:59:19 AM UTC | 0 ⭐ | 446 👁️ | Never ⏰ | []
C |

1.32 KB

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
void *point;
 
void *memory_alloc(unsigned int size)
{
    //printf("malloc...\n");
    void *ptr;
    ptr=point;
    unsigned int i=0, memsiz;
    while(i!=size)
    {
        memsiz=ptr+i;
        if(memsiz==NULL)
        {
            i++;
        }
        else
        {
            memsiz=ptr+i;
            i++;
        }
        //printf("%p\n", memsiz);
    }
    //printf("malloc end...\n");
    return ptr;
}
void memory_free(void *ptr)
{
    //printf("freeing mem...\n");
    unsigned int i,memsiz;
    if(point!=ptr)
    {
        printf("Invalid pointer!");
        return 1;
    }
    unsigned int size=sizeof(ptr);
    for(i=0;i<=size;i++)
    {
        memsiz=ptr+i;
        memsiz=NULL;
    }
    //printf("freemem end...\n");
}
 
void memory_init(void *ptr, unsigned int size)
{
    //printf("meminit...\n");
    unsigned int i;
    point=ptr;
    for(i=0;i<=size;i++)
    {
        ptr=ptr+i;
        ptr=NULL;
    }
    //printf("meminit end...\n");
 
}
 
int main()
{
    char region[50];
    memory_init(region, 50);
 
    char* pointer = (char*) memory_alloc(10);
    if (pointer)
        memset(pointer, 0, 10);
    if (pointer)
        memory_free(pointer);
 
    return 0;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Syutrsz icon
    03/31/26 11:01:41 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  • Duizxy icon
    05/15/26 01:18:33 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best Pastebin.com alternatives paste sites list
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400