+ 1
How can i deleat an element from an array (dynamic input)
i want to deleat an element from an array where in put is dynamic ex-: int ar[] = new int[n];
7 Antworten
+ 1
search the element and shift elements.
for(I=0;I<n;I++)
{
if(ar[I]==num)
{
for(j=I;j<n-1;j++)
ar[j]=ar[j+1];
}
}
+ 1
yes the array still would be n dimensional
I am not sure but you can try delete ar[n] if it deletes only nth index.
+ 1
@Kamil
Sorry I didn't read your answer(question) completely but I think there is no way to change a
N-dimensional array to X-dimensional.😂😂😁😁
+ 1
I was referring to this one
@Megatron wont the array still be n dimensional?
0
@Megatron wont the array still be n dimensional?
0
I dont think there is any other way with array than creating new array with m elements and just copy all the values except that one
0
by creating new array I meant new array variable