C++ Struct:Array:Pointer

Objectives :

  • myStructArrayPtr2.cpp
    sending two dimensional array as a parameter to a function.
  • This example is similar to this one.myStructArrayPtr2.htm
    Struct typedef (alias) was used as an array
    We used  array object and index of an array , in an argument that would fetch a struct object

  • code : myStructArrayPtr3.txt

Step: 1 Create a source file.

 

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

a) The function void display(pEmp obj1) , is not affected how the information was fed. The information fed with a pointer ( emprec->id)  was a deep copy, linked the address of an object stored in memory. On the other hand , "cin>> lid;" was a soft copy and did not adhere or was not attached to the struct-array object. 

b)

Step: