code for stack use array