Suppose that a stack s and a queue q of characters are initially empty. Show s and q after each iteration of the second for loop of the following  code fragment:
for(char ch = 'A'; ch <= 'H'; ch++) 
    s.Push(ch); 
for(int i = 1; i <= 4; i++) { 
    s.Pop(); 
    q.Enqueue(s.Top()); 
    s.Pop(); 
    q.Enqueue(s.Top()); 
    s.Push(q.Front()); 
    q.Dequeue( ); 
}
ANSWER: s: A  B  C  E 
          q: E  D  D  C

Could someone tell me how these answers came about step by step...tried figuring them out but could not.

int x;
int* p= &x

which will decrement x?
*(p--);
(*p)--;
(&p)--;
(*&p)--;
or none of the above?

would this be none of the above?

lastly

what is the value of the expression f(3)?

int Func(int n)
{
if(n==0)
return 0;
else if (n==1)
return 1;
else
return Func (n-1)+Func(n-2);
}

Thx for the help

The best way to understand these is to get a compiler and step through while it is debugging or get it to print out at certain steps.

One thing the pointer p is assigned the address of x but x is not assigned a value so i guess your assuming x has a value

int x =3;
int* p= &x;

(*p)--;
cout << "value of p: " << *p;
cout <<"address of p: " << p ;

And i say do this in debug mode as your moving the address of p which means it will be pointing at garbage for some of the cout statements

The function is the Fibonacci series and it should be easy for you to find information on the internet

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.