Question: Please explain how to code the following and make it match the outputs screenshotted. / / * * * / / * * * You
Please explain how to code the following and make it match the outputs screenshotted.
You may modify this file but don't submit it
#include
#include
#include
#include hwh
int mainint argc, char argv
if argc
fprintfstderr "need two numbers
;
return EXITFAILURE;
int valn int strtolargv NULL, ;
int valk int strtolargv NULL, ;
if valn valk
return EXITFAILURE;
ListNode head NULL;
head createListvaln;
eliminatehead valk;
return EXITSUCCESS;
#include
#include
typedef struct ListNode
int value;
struct ListNode next;
ListNode;
void printListNodeListNode head
if head NULL return;
ListNode p head;
printfprintListNode: ;
do
printfd pvalue;
p pnext;
while p head;
printf
;
ListNode createListint valn
if valn return NULL;
ListNode head ListNodemallocsizeofListNode;
headvalue ;
ListNode current head;
for int i ; i valn; i
ListNode newNode ListNodemallocsizeofListNode;
newNodevalue i;
currentnext newNode;
current newNode;
currentnext head;
return head;
void eliminateListNode head, int valk
if head NULL valk return;
ListNode current head;
printListNodehead;
while currentnext current
for int i ; i valk ; i
current currentnext;
ListNode toDelete currentnext;
printfprintListNode: d
toDeletevalue;
currentnext toDeletenext;
freetoDelete;
printListNodecurrentnext;
printfprintListNode: d
currentvalue;
You may modify this file but don't submit it
#ifndef HWH
#define HWH
#include
typedef struct node
int value;
struct node next;
ListNode;
void printListNodeListNode head;
ListNode createListint valn;
void eliminateListNode head, int valk;
ListNode deleteNodeListNode head, ListNode todelete;
#endif
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
