Results 1 to 3 of 3

Thread: I need help with Memory Allocation in C

                  
   
  1. #1
    DCEmu Newbie CT_Bolt's Avatar
    Join Date
    Mar 2006
    Location
    Somewhere in Space
    Posts
    39
    Rep Power
    0

    Question I need help with Memory Allocation in C

    Information:
    I know how to dynamically allocate and free memory in C++

    Problem:
    I tried to dynamically allocate memory in C and it doesn't support these 2 functions:
    new, delete


    Question:
    How do i write this code in C?
    int *x;
    x = new int[5];
    delete [] x;
    x = 0;

  2. #2
    PSP Coder MikeDX's Avatar
    Join Date
    Dec 2005
    Location
    UK
    Age
    48
    Posts
    1,029
    Rep Power
    75

    Default

    Code:
    int *x;
    
    x=(int *)malloc(sizeof(int)*5);
    
    free(x);
    Find yourself some ebay spelling mistake bargains!
    Use the power of the TYPING WAND! |Free PSP ISOs to download

    Pick of the google street views! Including topless girls

    Proud owner of a Nintendo Wii!
    PSP1. Black Jap 1000K: 1.5 -> 2.71SE-A -> 2.71SE-B -> 2.71SE-B' -> 2.71SE-B''
    PSP2. Black "non worker" from ebay: 2.6 (?) -> 2.71 -> 1.5 -> 2.71SE-B -> 2.71SE-B'
    PSP3: Black "Broken UMD Drive" UK 1003 2.0 -> 1.5 -> 2.71SE-B -> 2.71SE-B'
    Do you have a bricked psp?

  3. #3
    DCEmu Newbie CT_Bolt's Avatar
    Join Date
    Mar 2006
    Location
    Somewhere in Space
    Posts
    39
    Rep Power
    0

    Default Thank you.

    Thank you much MikeDX!

    This is exactly what I was looking for. :thumbup:

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •