+ 1

I need to know how to delete array element

plz send me a code for example of this question

20th Apr 2018, 5:12 AM
Harendra Keshawa
Harendra Keshawa - avatar
7 Respostas
+ 4
To remove by value: book remove = false; for(int i=0; i < array.length-1; i++){ if(remove){ array[i] = array[i+1]; continue; } if(array[i] == value){ remove = true; array[i] = array[i+1]; } }
20th Apr 2018, 5:20 AM
Ariela
Ariela - avatar
+ 4
Do you want to do it by index or value?
20th Apr 2018, 5:15 AM
Ariela
Ariela - avatar
+ 3
Do you want to do it by index or value?
20th Apr 2018, 5:15 AM
Ariela
Ariela - avatar
+ 3
But basically for index (array is the array): int remove = 10; for(int i=remove; i < array.length-1; i++){ array[i] = array [i+1]; }
20th Apr 2018, 5:17 AM
Ariela
Ariela - avatar
+ 1
both
20th Apr 2018, 5:16 AM
Harendra Keshawa
Harendra Keshawa - avatar
+ 1
i want know how to remove array element in array ?
20th Apr 2018, 5:19 AM
Harendra Keshawa
Harendra Keshawa - avatar
+ 1
thanks a lot. i will try
20th Apr 2018, 5:22 AM
Harendra Keshawa
Harendra Keshawa - avatar