Page 328 - C++
P. 328

The function should display the content in the following format :

                            25      24      23      22


                            20      19      18


                            15      14


                            10


           (c)     Let  us  assume  Data[20][15]  is  a  two-dimensional  array,  which  is

                   stored  in  the  memory  along  the  row  with  each  of  its  elements
                   occupying  2  bytes.  Find  the  address  of  the  element  Data[10][5],  if
                   the element Data[15][10] is stored at the memory location 15000.                3



           (d)     Write  the  definition  of  a  member  function  AddPacket()  for  a  class
                   QUEUE  in  C++,  to  remove/delete  a  Packet  from  a  dynamically

                   allocated  QUEUE  of  Packets  considering  the  following  code  is
                   already written as a part of the program.                                       4


                   struct Packet
                   {
                       int         PID;
                       char        Address[20];

                       Packet  *LINK;
                   };



                   class QUEUE
                   {
                       Packet *Front, *Rear;
                   public:
                       QUEUE(){Front=NULL;Rear=NULL;}
                       void AddPacket();

                       void DeletePacket();
                       ~QUEUE();
                   };

      91                                             9                                        P.T.O.
   323   324   325   326   327   328   329   330   331   332   333