Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C, if i have the following code incomplete code : #include #include #include extern int pop(); extern void push(int); int main(int argc, char *

In C, if i have the following code incomplete code :

#include #include #include extern int pop(); extern void push(int);

int main(int argc, char * argv[]) { int ch; while ((ch = getchar()) != EOF) { if (!(isalpha(ch) || ch == '>' || ch == '<' || ch == '/')) continue; // } exit(0); }

where after "continue" the rest of the code goes and pop() and push(int) are the Stack operations.

If a user enters input in the XML form such as : .... where is the starting tag and is the ending tag, then please write the rest of the code that checks if the "<" is followed by a "/" then it recogonizes it as a end tag and then uses the pop() function. Otherwise it recgonizes it as a start tag and uses push(x) function to add the element "x" onto the stack. Suppose the stack.c has the function pop() and push(x) function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Databases questions