C++

Objectives :

  • myStructArrayPtr2.cpp
    //myStructArrayPtr2.cpp
    //Struct cotained array
    //pointer represents an argument-> for an array object
    //operator ->
    --------------Struct members-------------
    typedef struct Emp
    {
    string name; string sal;int id;
    } pEmp;
    ---------------Struct used as an array object-----------

    ------* codes to get users' inputs and display using a pointer----
  • Struct can be used as an parent array
  • code : myStructArrayPtr2.txt

Step: 1 Create a source file.

Step: 2 Edit and save Source file

Step: 3 Runtime Views:

  • Passing as an array to the function display(emprec[lid ]);
  • Passing as a pointer to the function display(emprec[emprec->id]);


Step: