array insertion with condition
hello there! can anyone help me with this could code.any suggestions and ideas will be very much appriciated.
[tag]
Code:
int insB4Odd(int LA[],int n,int num){
[/I]/*this function inserts item num b4 the index position
of the first odd integer in the array list LA w/ n elements*/
int j=0;
while(j<n){
if(LA[j]%3==0)
/*this is the part where i'm stuck*/
}
return(++n);
}
int insAftrEven(int LA[],int n,int num){
[I]/*this is somewhat the same with the above function,but instead of inserting b4 odd,item num is inserted after even number in the array list*/
int j=0;
while(j<n){
if(LA[j]%2==0)
[/I]/*I'm also stuck here.If I can just get the B4Odd, there's gonna
be no problem here*/
}
return (++n);
}
int delNum(int LA[],int n,int num){
[I]/*deletes the integer num from the array list LA if it exists,
otherwise no deletion is made*/
int i;
for(i=0;i<n;i++){
if(LA[i]==num)
[/I]/*What would be the next part?*/}
return (--n);
}
int delAll(int LA[],int num){
/*deletes all items that are not unique*/
Just give me an idea on how to go about this function.
[/tag]
Thank you in advance.