Question: To prevent a compile-time error, how should the following code be changed? struct ListNode // Line 1 { // Line 2 intdataVal; // Line 3
To prevent a compile-time error, how should the following code be changed?
struct ListNode // Line 1 { // Line 2 intdataVal; // Line 3 NodeType* next; // Line 4 } // Line 5
1. Insert the following before line 1:
typedef ListNode* NodeType*;
2. the following before line 1:
struct ListNode;
typedef ListNode* NodeType*;
3. Replace line 4 with the following:
ListNode* next;
4. Either Insert the following before line 1:
typedef ListNode* NodeType*;
5. None of these answers is correct.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
