Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

include

int choice, stack[10], top, element;

void menu();

void push();

void pop();

void showelements();

void main()

{

choice=element=1;

top=0;

menu();

}

void menu()

{

printf("Enter any options from following:\n");

printf("PUSH 1\n POP 2\n DISPLAY ELEMENTS 3\n EXIT 4\n");

scanf("%d", &choice);

if (choice==1)

{

push();

menu();

}

if (choice==2)

{

pop();menu();

}

if (choice==3)

{

showelements();

menu();

}

void push()

{

if (top<=9)

{

printf("Enter any element to be pushed to stack:\n");

scanf("%d", &element);

stack[top]=element;

++top;

}

else

{

printf("Stack full\n");

}

return;

}

void pop()

{

if (top>0)

{

--top;

element = stack[top];

printf("Popped element:%d\n", element);

}

else

{

printf("Stack empty\n");

}

return;

}

void showelements()

{

if (top<=0)

printf("Stack empty\n");

else

for(int i=0; i

printf("%d\n", stack[i]);

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9536522

Have any Question?


Related Questions in Computer Engineering

Switches are an integral part of networks they are the

Switches are an integral part of networks. They are the devices you utilize for host connectivity to the network. Please identify and discuss an attack that takes advantage of a weakness in switches.

Question imagine you are a junior researcher at a

Question: Imagine you are a junior researcher at a world-renowned, high-tech laboratory that receives millions of dollars in government grants each year. You have been assigned the task of writing a proposal for the DARP ...

Explain the risk of having hacking tools installed on your

Explain the risk of having hacking tools installed on your computer and why you should contact local law enforcement agencies before installing those tools.

Problem a design a 64kb 8-way set associative cache that

Problem : A. Design a 64KB 8-way set associative cache that has 32 words per blocks and 4 bytes per word (MIPS type). Assume a 32 bit address. a) Calculate the following a How many bits are used for the byte offset? b) H ...

Suppose that we have a binary counter with k bits where

Suppose that we have a binary counter with k bits, where each bit is stored in a array A[0..k - 1]. The operation Increment(A) increments the counter by adding 1 to the content of the counter modulo 2k . The cost of this ...

The decomposition of so2cl2 is first order in so2cl2 and

The Decomposition of SO2Cl2 is first order in SO2Cl2 and has a rate constant of 1.42*10-4s-1 at a certain temperature. What is the half-life for this reaction?

Answer the following questions suppose that multiplying two

Answer the following Questions : Suppose that multiplying two general n by n matrices takes 3 seconds on a given computer, if n = 1000. Estimate how much time it will take to compute the LU-decomposition of such a matrix ...

One-year treasury bills currently earn 225 percent you

One-year Treasury bills currently earn 2.25 percent. You expected that one year from now, 1-year Treasury bill rates will increase to 2.75 percent and that two years from now, 1-year Treasury bill rates will increase to ...

Two countries australia and france have their interest

Two Countries Australia and France have their interest rates to be 8% and 2 %, respectively. If their currencies trade according to 2 Australian $s buy one euro in the spot market, what will their future spot rate be in ...

If we take infinite samples of size n 49 from a population

If we take infinite samples of size n = 49 from a population with a distribution with high kurtosis and standard deviation 7, select the best answer below. * The sampling distribution of the sample means will have a stan ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As