Remove an item from the list
The function should remove the element structure (unidirectional linear list) ID. Element ID the structure indicated by
@Maris Mistral, If you are given a comprehensive answer, mark it as correct (click the check mark next to the selected answer). - 05-12-2012 в 17:51:10
Note on condition :
I think there should be "!="
Answered: 05-12-2012 в 11:21:29
@Maris Mistral, @margosh exactly point You to one of the errors (typo?).
And yet, if
Usually I write approximately so
And yet, if You want to change first in the calling program, then it either should be passed by reference, or pass it address. Personally, I prefer pass by reference, not to use it, because in the calling program directly referring to call it is not clear whether the argument to change.
Specifically this fragment I would write this
Frankly, not tested, checked only compilation
with this announcement
Answered: 05-12-2012 в 12:42:01
IMHO, so pantova. If you understand magic skill is increased by 100.
Nothing seems to be messed up. About the code from the question of the author - too much of any unnecessary and confusing record. It is necessary to write easier - then easier to understand, is no stranger to writing (p == NULL) etc. in General it is necessary not to be lazy and sit an hour or two on the code to well quite get the task.
Answered: 05-12-2012 в 14:41:52
You have in your first
@VladD, skill fell (ibid comment - magic). Initialization is the first assignment, checks its result, if assigned NULL, then the while loop is not executed. @o2n3e, do not say anything, beautiful. Magic is bullshit, but combine with the previous the first is I liked it. - 05-12-2012 в 16:53:48
@avp: and really confused
But in this bid. If the gash pulec 100500*100500 elements of a list and not using malloc, and id replace affectum, the deletion of the element will fly. Whether the people are not used to the current amd64 virtual addresses can be овер10бит more than he can physically addressing the frame. And what is actually on amd64 managery the pile of random pieces do not need. Toli is left over from last 32битной x86 architecture. In General, it pichalno, stupid, mortal compatibility. - 05-12-2012 в 17:44:21
@o2n3e, are You serious? And if all so will start, swap on a server is enough? And about pageout thought, the OS does not know that the modified pages are no longer needed. Although, maybe I don't understand. You probably want to reuse the similar structures from the pool to purl them on the free list and give-back? - 05-12-2012 в 17:52:41