hi, i'd like to reverse each line in stdin and reverse the order of lines in each ``paragraph''. Each paragraph must be reversed by pushing structs containing line numbers and stacks of characters onto a stack and later popping them off and printing them
line 1. 2:.2 enil
line 2. 1:.1 enil
para 2. 4:.2 arap
para 3 7:2l3p
that's the interface
the C type which will be used to represent stacks.
extern Stack stack_init(size_t el_size); given the size of the elements, an empty stack is returned.
extern Stack stack_push(Stack s, void *el_ptr);given a stack and a pointer to a new element, a new stack is returned with the new element pushed on.
extern Stack stack_pop(Stack s);given a stack, the top element is removed and the resulting stack is returned.
extern void stack_top(Stack s, void *el_ptr);given a stack and the address of an element, the top of the stack is copied to the element.
extern int stack_is_empty(Stack s);given a stack, returns 1 if the stack is empty and 0 otherwise
extern void stack_free(Stack s);given a stack, reclaims the memory used by the stack
i 'm really stuck how to write that ..can anyone guide me how to write that from beginning (code is not necessary)
i create a struct of stack ..but i think it's not gonna work
typedef struct head_Node
struct paranode *Next;
struct paranode *next;
sorry, i just have no idea....thanks in advance..