Jump to content

Photo

Two Functions I Need


  • Please log in to reply
No replies to this topic

#1 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 16 July 2011 - 11:27 AM

I need two functions for working with arrays.
1. Insert into slot: which inserts the element into the specific position in the array and shifts the following elements including the one that was in the position that I want to insert the element into down along the array.
2. Remove slot from arrayl This basically removes a elemeny from an array and shifts the elements following up along the array.

EDIT: Oh and I'll be using resizable arrays too using the method gleeok shared.
CODE
//suppose you need 100 to 1000 blocks.
int arrayX[1024]; //round it up
int arrayXsize = 0; //keep track of the true size here

...
for(int i;i < arrayXsize; ++i)
{
  if(arrayX[i] == 0)
    arrayXsize--; // or whatever
}

Edited by blackbishop89, 16 July 2011 - 11:28 AM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users