Question 4. Stacks [9]

Given the definitions below for a node struct and push and pop stack functions, provide appropriate implementations for the two functions.

// a stack of floats, assumes that next points
//    to the node 'below' the current one
struct node {
   float data;
   node *next;
};

// assuming top is a pointer to the current top node,
//    push d onto the top of the stack 
// return true iff successful
bool push(float d, node* &top);

// assuming top is a pointer to the current top node,
//    pop the top value off the stack into d
//    and delete the popped node
// return true iff successful
bool pop(float &d, node* &top);