C programming I could use some clear instructions please 3. Create a program nam
ID: 3684143 • Letter: C
Question
C programming I could use some clear instructions please3. Create a program named DynamicList. Create a data structure for classes at UCF. It should have the class identifier such as COP3223 and other information such as the department. Create a linked list of four classes from within a function named CreateList. Now display all items in list from a function named WalkListAndDisplay.
C programming I could use some clear instructions please
3. Create a program named DynamicList. Create a data structure for classes at UCF. It should have the class identifier such as COP3223 and other information such as the department. Create a linked list of four classes from within a function named CreateList. Now display all items in list from a function named WalkListAndDisplay.
I could use some clear instructions please
3. Create a program named DynamicList. Create a data structure for classes at UCF. It should have the class identifier such as COP3223 and other information such as the department. Create a linked list of four classes from within a function named CreateList. Now display all items in list from a function named WalkListAndDisplay.
Explanation / Answer
#include <stdio.h>
struct class{
char department[50];
int id;
};
struct class* CreateList(){
struct class c[4];
int i;
printf("Enter information of classes: ");
for(i=0;i<4;++i)
{
printf("Enter department: ");
scanf("%s",&c[i].department);
printf("Enter id: ");
scanf("%d",&c[i].id);
printf(" ");
}
return c;
}
void WalkListAndDisplay(struct class c[4]){
printf("Displaying information of classes: ");
for(int i=0;i<4;++i)
{
printf("Department: ");
puts(c[i].department);
printf("id: %d",c[i].id);
}
}
int main(){
struct class * c;
c = CreateList();
WalkListAndDisplay(c);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.