Question: #include #include typedef struct IntNode _ struct { int dataVal; struct IntNode _ struct * nextNodePtr; } IntNode; / / Constructor void IntNode _ Create
#include
#include
typedef struct IntNodestruct
int dataVal;
struct IntNodestruct nextNodePtr;
IntNode;
Constructor
void IntNodeCreateIntNode thisNode, int dataInit, IntNode nextLoc
thisNodedataVal dataInit;
thisNodenextNodePtr nextLoc;
Insert newNode after node.
Before: thisNode next
After: thisNode newNode next
void IntNodeInsertAfterIntNode thisNode, IntNode newNode
IntNode tmpNext NULL;
tmpNext thisNodenextNodePtr; Remember next
thisNodenextNodePtr newNode; this new
newNodenextNodePtr tmpNext; this new next
Grab location pointed by nextNodePtr
IntNode IntNodeGetNextIntNode thisNode
return thisNodenextNodePtr;
int IntNodeGetDataValIntNode thisNode
return thisNodedataVal;
int mainvoid
IntNode headObj NULL; Create intNode objects
IntNode currObj NULL;
IntNode lastObj NULL;
int i; Loop index
int negativeCntr;
negativeCntr ;
headObj IntNodemallocsizeofIntNode; Front of nodes list
IntNodeCreateheadObj NULL;
lastObj headObj;
for i ; i ; i Append rand nums
currObj IntNodemallocsizeofIntNode;
IntNodeCreatecurrObjrand NULL;
IntNodeInsertAfterlastObj currObj; Append curr
lastObj currObj; Curr is the new last item
currObj headObj; Print the list
while currObj NULL
printfd IntNodeGetDataValcurrObj;
currObj IntNodeGetNextcurrObj;
printf
;
currObj headObj; Count number of negative numbers
while currObj NULL
Your solution goes here
currObj IntNodeGetNextcurrObj;
printfNumber of negatives: d
negativeCntr;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
