******** fig3.47a ********** STACK create_stack( unsigned int max_elements ) { STACK S; /*1*/ if( max_elements < MIN_STACK_SIZE ) /*2*/ error("Stack size is too small"); /*3*/ S = (STACK) malloc( sizeof( struct stack_record ) ); /*4*/ if( S == NULL ) /*5*/ fatal_error("Out of space!!!"); /*6*/ S->stack_array = (element_type *) malloc( sizeof( element_type ) * max_elements ); /*7*/ if( S->stack_array == NULL ) /*8*/ fatal_error("Out of space!!!"); /*9*/ S->top_of_stack = EMPTY_TOS; /*10*/ S->stack_size = max_elements; /*11*/ return( S ); }