Ask coding questions

← Back to all posts
Question about C array :)
AquaMarine0421 (68)

Hi guyz :) I'm a beginner in coding, and I am learning C language nowadays. I have a question about arrays in C program; how exactly can you eliminate numbers that satisfy a certain condition (e.g. over 10, odd number, etc.) from an integral array?
EDIT: for example, lets say that there's an user-defined array called arr[10]. In that array, numbers 1 thru 10 are contained. What code should I use if I wanna eliminate even numbers from the array?

Answered by a5rocks (830) [earned 5 cycles]
View Answer
Comments
hotnewtop
a5rocks (830)

http://www.cplusplus.com/reference/algorithm/remove_if/ might help

especially the example, which you should look at.