טוב אז ככה אני צריך לממש פונקציה מסויימת
int addDepartment(Department *head, char *name);
|
אלו הסטראקטים שלי
struct Department { char *name; int numOfEmployees; struct Department *nextDep; struct Employee *firstEmp; };struct Employee { char *firstName; char *lastName; int salary; struct Employee *nextEmp; };
|
זאת התוכנית
void MainMenu ()struct Department *TopDepartmentList ; char Dname; char *name; . . . . printf("\nEnter The Name Of The Department:\n"); scanf("%s",&Dname); name=Dname; addDepartment(TopDepartmentList,name); . . . } void addDepartment(struct Department *head, char *name ) { head.name=name; head.numOfEmployees=5; if (head.nextDep==NULL) { printf("NULL"); } return 0;
|
עכשיו הקטע שאני לא מבין.
הרי אני צריך להשתמש ב מאללוק בשביל ליצור מערך דינמי.
איפה אני אמור להשתמש בו?
לפני הקריאה לפונקציה?
במידה וכן אני צריך ליצור משתנה מסוגג
struct Department **DEP
?
אני צריך לעשות מעיין מערך נתונים של חברה שאני יוכל להוסיף ולהוריד מחלקות.
הבנתי שאני צריך איזה שהוא פויינטר שהוא יהיה מסוג מחלקה שיצביע לי על מערך של מחלקות
איך אני יכול לבדוק האם head.nextDep==NULL ?
אם מישהוא יכול לכוון אותי או לזרוק מידע זה יעזור לי ..
תודה רבה!
