Question
in C please #include typedef struct _letter { char info; struct _letter *next; } Letter; int main(void) { Letter a, b, c, d, e, f,
in C please
#include
typedef struct _letter { char info; struct _letter *next; } Letter;
int main(void) { Letter a, b, c, d, e, f, g, h, i, j, k, l, m;
a.info = 'E'; b.info = 'L'; c.info = 'E'; d.info = 'V'; e.info = 'E'; f.info = 'N'; g.info = 'P'; h.info = 'L'; i.info = 'U'; j.info = 'S'; k.info = 'T'; l.info = 'W'; m.info = 'O';
a.next = &b; b.next = &c; c.next = &d; d.next = &e; e.next = &f; f.next = &g; g.next = &h; h.next = &i; i.next = &j; j.next = &k; k.next = &l; l.next = &m; m.next = NULL;
// Print the word Letter *ptr = &a; while ( ptr != NULL ) { printf("%c", ptr->info); ptr = ptr->next; } printf(" ");
// Relinks the 13 nodes here so that it spells "TWELVEPLUSONE" // YOU CANNOT CHANGE THE "info" FIELD of ANY NODES
// After rearranging, print the new word ptr = &k; while ( ptr != NULL ) { printf("%c", ptr->info); ptr = ptr->next; } printf(" ");
return 0; }
Name this program one.c-You can download the starting one.c from Blackboard. The starting one.c creates a linked list of 13 nodes to represent "ELEVENPLUSTWO". Your job is to relink the 13 nodes in the specified space to form a linked list to represenTWELVEPLUSONE". You can only change the "next" field of these 13 nodes. You can't change the "info" field of any nodesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started