Hi,
This program takes in employees details like name,title,salary etc and should return the structure array.I am not being able to return the array of structure.I think I am doing something wrong on declaring the type of the function.
Ohk just to try and get up to speed with what you want. is to return the information which you just inserted by using getpayroll funciton.
1) I'm not sure about creating another "struct employeeRecordT" inside your get payroll function you already did that part at the very top. Will someone also inlighten me why that worked the structure iside a method i mean.
2) You using pointers and the reseaon your function is not returning or even compiling is because it is being confused.
if you using pointers and assigning to variables try e.g. pointer->name = name ... if not then dont instantiate pointer as *pointer
just let it be pointer without the astrict then you can use pointer[i].name = name. its all about speed.
have a look at your function name you telling the compiler you will return a structure which is not a pointer, but in the end you
returning a pointer.
I know I know i just confused you with pointer pointer. I'm not that good in explaining but i try heres the diffrence
employeeRecordT* GetPayroll(int n) <---------------------------Note the * by the function
employeeRecordT *pointer = new employeeRecordT[n];
return pointer
whereas
employeeRecordT GetPayroll(int n) <---------------------------No astrict
employeeRecordT pointer = new employeeRecordT[n]; <--------------------------Same goes here when instantiating
return pointer
3) With those two things out of the way you good to for loop your structure to show output. Hope I'm clear enough.