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-----------
![](myStru6.jpg)
------* codes to get users' inputs and display using a
pointer----
![](myStru7.jpg)
- Struct can be used as an parent array
- code : myStructArrayPtr2.txt
|
Step: 1 Create a source file.
![](myStru8.jpg)
![](myStru9.jpg)
|
Step: 2 Edit and save Source file
![](myStru10.jpg)
|
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]);
![](myStru19.jpg)
![](myStru11.jpg)
|
Step:
|
|