Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9247591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:46:04+00:00 2026-06-18T09:46:04+00:00

void EventsStack::push(Event *e){ EventNode *q = new EventNode(); q->data = e; q->next = _top;

  • 0
void EventsStack::push(Event *e){
    EventNode *q = new EventNode();
    q->data = e;
    q->next = _top;
    _top = q;
}

void main() {
    EventsStack eventStack;
    Event e1(1);
    eventStack.push(&e1);
    Event e2(2);
    eventStack.push(&e2);
}

First question: when I do

eventStack.push(&e1);

am I sending the ADDRESS of e1 to the push function, and the push function receiving it as a pointer? as if I am doing:

Event *e = 1000 (1000 is the offset (address) of e1 for example on the stack)

?

Second question: I am asked to illustrate the stack upon running the main function. When I get to the line

eventStack.push(&e1);

does a 4 byte return address and a 4byte pointer to e1 get allocated as the function’s activation frame or in this situation there is no activation frame since eventStack is an object of the class EventsStack and the push is one of its’ member functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:46:05+00:00Added an answer on June 18, 2026 at 9:46 am

    Regarding your first question, yes: the & operator yields the memory address of your Event.

    As to your second question, well, it’s complicated. The description you made seems to indicate an underlying confusion as to how the stack works. I’d strongly recommend going over some introductory material on the topic, it’s going to leave you with a much stronger understanding.

    You’ll be able to answer your own question a few hours from now if you go Google a bit :).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

void ServerManager::addWork(SocketClient *clientSocket, vector<char> data){ Work *work = new Work(clientSocket, data); m_workHandler->addWork(work); } Here
void slice_first_char(char ** string) { *string = &(*string[1]); } int main(int argc, char *
void foo(void **Pointer); int main () { int *IntPtr; foo(&((void*)IntPtr)); } Why do I
void say(char msg[]) { // using pointer to print out the first char of
void f(char* p) {} int main() { f(Hello); // OK auto p = Hello;
void foo(const Object & o = Object()) { return; } In the function above,
void printOutput(std::string text); void printOutput(std::string& text); Both functions print some text out to the
void Foo() { System.Windows.Forms.Form f = new System.Windows.Forms.Form(); f.Show(); } To my understanding f
void main(){ int i,k; char* p; int j; printf(address of i is %d \naddress
void GenerateSurvey(string AnketId, System.Web.UI.WebControls.PlaceHolder plch) { var db = new Xrm.XrmDataContext(Microsoft.Xrm.Client.CrmConnection.Parse(Utils.getXrmConnectionString(_PortalBrandHelper.BrandProxy.BrandDedicatedCrmOrgName))); var AnketSoru =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.