Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

link list c programming help?

I have sturcture which is given to me

typedef struct program* ProgramTypePtr;

typedef struct course* CourseTypePtr;

/* Structure definitions. */

typedef struct teachPeriod

{

char semester; /* 'y' or 'n' for each semester */

unsigned year; /* 2010 by default */

} TeachPeriodType;

typedef struct course

{

char courseID[COURSE_ID_LEN + 1]; /* Unique ID for a course */

char progID[PROG_ID_LEN + 1];

char courseTitle[MAX_TITLE_LEN + 1];

char courseCode[COURSE_CODE_LEN + 1];

unsigned creditPoints;

TeachPeriodType teachPeriods[NUM_TEACHPERIODS];

char courseDescription[MAX_DESC_LEN];

CourseTypePtr nextCourse;

} CourseType;

typedef struct program

{

char progID[PROG_ID_LEN + 1]; /* Unique ID for a program */

char progTitle[MAX_TITLE_LEN + 1];

char progMajor[MAX_TITLE_LEN + 1];

char progCode[PROG_CODE_LEN + 1];

float progDuration;

char progType[PROG_TYPE_LEN]; /* Undergrade(UG) or Postgrad (PG) */

char progMode[MODE_LEN]; /* Full-time (FT) or Part-time (PT) */

char progDescription[MAX_DESC_LEN];

char majorDescription[MAX_DESC_LEN];

ProgramTypePtr nextProgram;

CourseTypePtr headCourse;

unsigned numCourses;

} ProgramType;

typedef struct pms

{

ProgramTypePtr headProgram;

unsigned numPrograms;

} PMSType;

I just wana know how to add programs and add courses. Each program can have many courses.

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    You use PMSType to store the list of all programs. When adding a program, you use the nextProgram field within program to manipulate the linked list or programs.

    For a given program, you use the headCourse type to store the list of courses for that program. When adding courses, you use the nextCourse field within course to manipulate the linked list of courses.

    You also have to keep the counts up to date: numPrograms and numCourses when you insert into the lists.

  • ?
    Lv 4
    4 years ago

    linked checklist is one in all the easy records systems, and can be used to enforce different records systems. It includes a chain of NODES, each containing records fields and one or 2 references ("links") pointing to the subsequent and/or previous nodes. examples are a million. Singly-linked checklist >> the simplest form of linked checklist is a singly-linked checklist (or slist for short), which has one link consistent with node. This link factors to the subsequent node interior the checklist, or to a null fee or empty checklist if it extremely is the suitable node. 2. Doubly-linked checklist >> A greater state-of-the-artwork form of linked checklist is a doubly-linked checklist or 2-way linked checklist. each node has 2 links: one factors to the previous node, or factors to a null fee or empty checklist if it extremely is the 1st node; and one factors to the subsequent, or factors to a null fee or empty checklist if it extremely is the suitable node. 3. Circularly-linked checklist >> In a circularly-linked checklist, the 1st and extremely final nodes are linked jointly

Still have questions? Get your answers by asking now.