Difference between pages "r6:Function:stack new" and "r6:Function:stack pop"
(Difference between pages)
Jump to navigation
Jump to search
m (1 revision imported) |
m (1 revision imported) |
||
Line 1: | Line 1: | ||
==Source Files== | ==Source Files== | ||
/src/stack/ | /src/stack/stack_push_pop.c | ||
/inc/liblfds.h | /inc/liblfds.h | ||
==Prototype== | ==Prototype== | ||
int | int stack_pop( struct stack_state *ss, void **user_data ); | ||
==Parameters== | ==Parameters== | ||
''struct stack_state | ''struct stack_state *ss'' | ||
: A | : A stack state as allocated by ''[[r6:Function:stack_new|stack_new]]''. | ||
'' | ''void **user_data'' | ||
: The | : The address of a pointer into which the user data will be placed. If the stack is empty, ''*user_data'' is not modified, as NULL is a valid user data value. | ||
==Return Value== | ==Return Value== | ||
The return value is 1 upon successful pop, 0 upon unsuccessful pop. Popping fails only if the stack is empty. Note that on an unsuccessful pop, ''*user_data'' is untouched; it is not set to NULL, since NULL is a valid user data value. Only the return value indicates whether or not the pop was successful. | |||
==Notes== | ==Notes== | ||
No notes. | |||
==See Also== | ==See Also== | ||
* [[r6:API:Stack|Stack]] | * [[r6:API:Stack|Stack]] | ||
* [[r6:Function: | * [[r6:Function:stack_push|stack_push]] | ||
* [[r6:Function:stack_guaranteed_push|stack_guaranteed_push]] |
Latest revision as of 14:07, 4 January 2015
Source Files
/src/stack/stack_push_pop.c /inc/liblfds.h
Prototype
int stack_pop( struct stack_state *ss, void **user_data );
Parameters
struct stack_state *ss
- A stack state as allocated by stack_new.
void **user_data
- The address of a pointer into which the user data will be placed. If the stack is empty, *user_data is not modified, as NULL is a valid user data value.
Return Value
The return value is 1 upon successful pop, 0 upon unsuccessful pop. Popping fails only if the stack is empty. Note that on an unsuccessful pop, *user_data is untouched; it is not set to NULL, since NULL is a valid user data value. Only the return value indicates whether or not the pop was successful.
Notes
No notes.