コード例 #1
0
ファイル: seqstack.c プロジェクト: diffman/data_structure
int seqstack_gettop(seqstack S, DataType *item)
{
    if(seqstack_is_empty(S))
    {
        printf("sequece stack is empty, get top failed.\r\n");
        return 0;
    }
    *item = S.item[S.top];

    return 1;
}
コード例 #2
0
ファイル: seqstack.c プロジェクト: diffman/data_structure
int seqstack_pop(seqstack *S, DataType *item)
{
    if(seqstack_is_empty(*S))
    {
        printf("sequece stack is empty, pop failed.\r\n");
        return 0;
    }
    *item = S->item[S->top];
    S->top --;

    return 1;
}
コード例 #3
0
ファイル: seqstack.c プロジェクト: shufengdong/c-algorithms
ArrayListValue seqstack_peek(ArrayList *seqstack) {
	if (seqstack_is_empty(seqstack)) 
		return NULL;
	else 
		return seqstack->data[seqstack->length-1];
}