Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help defining this function: 2.2.3 void Decode(char *encMsg, char *decMsg

ID: 3631066 • Letter: I

Question

I need help defining this function:

2.2.3 void Decode(char *encMsg, char *decMsg) Parse and decode the message stored in the character array encMsg using the stack functions and return the decoded message in the character array decMsg. Encoding of the string shall use the following format:
2.2.3.1 Command: 1l -- Character 1 (one) means Push the following letter (l) onto the stack.
2.2.3.2 Command: 2n -- Pop n characters from the stack. If the stack should become empty before the appropriate number of characters has been popped then display a warning message to the user and terminate parsing this message.
2.2.3.3 When the last encoded command has been executed then the Decode function shall pop all characters, one at a time, from the stack, place them in the decMsg array and return the string to the caller.



the node looks like this

struct StackNode
{
char ch;
StackNode *next;

};

Explanation / Answer

This only seems to work for single line strings

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote