Page 279 - C++
P. 279

(c)     ARR[15][20]  is  a  two-dimensional  array,  which  is  stored  in  the
                   memory along the row with each of its elements occupying 4 bytes.
                   Find  the  address  of  the  element  ARR[5][15],  if  the  element

                   ARR[10][5] is stored at the memory location 35000.                              3



           (d)     Write the definition of a member function PUSHGIFT() for a class
                   STACK in C++, to add a GIFT in a dynamically allocated stack of
                   GIFTs considering the following code is already written as a part of
                   the program :                                                                   4


                   struct GIFT

                   {

                       int GCODE;                     //Gift Code

                       char GDESC[20];                //Gift Description

                       GIFT *Link;
                   };


                   class STACK

                   {

                       Gift *TOP;

                   public:

                       STACK(){TOP=NULL;}

                       void PUSHGIFT();

                       void POPGIFT();
                       ~STACK();

                   };



           (e)     Convert  the  following  Infix  expression  to  its  equivalent  Postfix
                   expression,  showing  the  stack  contents  for  each  step  of
                   conversion :                                                                    2

                           X – ( Y + Z ) / U * V

      91                                             9                                        P.T.O.
   274   275   276   277   278   279   280   281   282   283   284