✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Adott a következő Stack struktúra és műveletek:
typedef struct { int capacity; int top; int *elements;} Stack;
és a következő függvények:
createStack(capacity, &stack) – létrehoz egy üres veremet a megadott mérettel
push(&stack, x) – hozzáadja az x értéket a verem tetejére
pop(&stack) – eltávolítja és visszaadja a verem tetején lévő elemet
peek(&stack) – visszaadja a verem tetején lévő elemet eltávolítás nélkülint main(void){ Stack stack; createStack(5, &stack); push(&stack, 1); push(&stack, 2); push(&stack, 3); printf("%d ", pop(&stack)); printf("%d ", peek(&stack)); push(&stack, 4); printf("%d ", pop(&stack)); printf("%d ", pop(&stack));}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!