struct stack {
int array[10];
int size = 10;
int idx = 0;
};
void push(struct stack &s, int value) {
if (s.idx + 1 < s.size) {
s.array[s.i] = value;
s.i = s.i + 1;
}
}
int pop(struct stack &s) {
int res = NULL;
if (s.i > 0) {
res = s.array[s.i-1];
s.i = s.i - 1;
}
return res;
}
bool is_prime(int number) {
// TODO impl..
}
int main() {
struct stack stc;
push(stc, 2);
push(stc, 4);
push(stc, 5);
push(stc, 3);
push(stc, 2);
while (s.i > 0) {
printf("%d\n", is_prime(pop(stc)));
}
return 0;
}
Comments
Leave a comment