+ 1
How to select every elements of an array that donât have the index 2 for example??
I want to write something that will select all the elements of the array that donât equal the value of x so I thought it would be like that ( array[!x] ) but itâs not so how? Thanks:)
4 Answers
+ 5
//let arr be array of size n i.e. last element index -> n-1
//printing all elements excluding element with index x
//say print() method (function) prints on screen
for(int i = 0; i < n ; ++i) {
if( i != x ) {
print(arr[i]) ;
}
}
+ 1
Thanks
0
The index value doesnât equals x