library bu beyler:
2.
define STACK_SIZE 100
typedef int(burası char olacak) Stype;
stype STACK_EMPTY= -987654321; (bildiğim kadarıyla burası ya null olacak ya da "" olacak)
typedef struct
{
int top;
stype data[STACK_SIZE];
}stack_t s;
void initialize_s(stack_t *s)
{
s->top=-1;
}
int is_empty_s(stack_t *s)
{
if(s->top=-1)
return 1;
return 0;
}
int is_full_s(stack_t *s)
{
if(s->top== STACK_SIZE -1)
return 1;
return 0;
}
void push(stack_t *s, int item)
{
if(is_full_s(&s))
printf("Stack is empty");
else
{
(s->top)++;
s->data[s->top]=item; (burası strcpy olacak)
}
}
Stype pop(stack_t *s)
{
stype item;
if(is_empty_s(&s))
printf("Stack is empty");
item= STACK_EMPTY;(burası strcpy olacak)
else
{
item=s->data[s->top];(burası strcpy olacak)
(s->top)--;
}
return(item);
}