EDIT:
Typedef struct SPro{
int arrivalTime;
char processName[15];
int burst;
} PRO;
I have an array of type PRO
PRO Array[100];
PRO enteringProcess;
//initialize entering process
then I need to creat a new process and allocate memory for that process using malloc Then point the pointer from the array to the memory chunk that malloc returns.
PRO *newPro = (PRO *) malloc (sizeof(PRO));
newPro = enteringProcess;
ProArray[0] = *newPro;
It seems that I’m doing something wrong since my program crashes at run-time.
Any help? thanks!
Seems you need an array of pointers to PRO:
I don’t know what that
enteringProcessis, so I cannot give opinion. Just that you should not assign anything tonewProother than the return ofmallocor else you will leak the new object.