154k views
0 votes
Use C programming to answer the question:

LAB: Warm up: Contacts

A linked list is built in this lab. Make sure to keep track of the head node. Complete main.c to define the struct ContactNode with the following data members:
1. char contactName[]
2. char contactPhoneNumber[]
3. ContactNode* nextNodePtr

1 Answer

2 votes

Final answer:

In C programming, the ContactNode struct is defined to create a linked list with data members for the contact's name, phone number, and a pointer to the next node.

Step-by-step explanation:

The student's question involves defining a struct in the C programming language for a linked list. The struct, named ContactNode, will include the following data members: contactName[], contactPhoneNumber[], and a pointer to the next ContactNode, nextNodePtr. Here’s how the ContactNode can be defined:


typedef struct ContactNode {
char contactName[50];
char contactPhoneNumber[15];
struct ContactNode* nextNodePtr;
} ContactNode;

To use this struct, you would initialize and link ContactNodes in the linked list, keeping track of the head node which represents the start of the list.

User Chubbsondubs
by
7.6k points