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

  • SEARCH
  • Home
  • 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 7754617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:21:16+00:00 2026-06-01T12:21:16+00:00

I was just looking into the memory allocation of a program in C .

  • 0

I was just looking into the memory allocation of a program in C. I know that all the global and static variables are stored in a heap. Also, the stack stores all the function calls. I do have one doubt here though. Say I am calling the following function:

int ret;
int num = 10;
int arr[3] = {1,2,3};
int *ptr = &arr[0];
ret = giveNumber(num, ptr);

Here, I read that the parameters of the function call giveNumer() would also be stored in the same stack. But in what order will they be stored? If I popped the top of stack, which parameter will be popped first, num or ptr?

  • 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-01T12:21:17+00:00Added an answer on June 1, 2026 at 12:21 pm

    I know that all the global and static variables are stored in a heap.
    No, thats not true.
    As per the standard they are stored in implementation defined memory regions, typically the Data segment and the BSS.

    If I popped the top of stack, which parameter will be popped first, num or ptr
    The order of evaluation of arguments to a function is Unspecified.
    So it depends on your compiler implementation. An compiler might evaluate the arguments from:

    • Left to Right or
    • Right to Left or
    • Any other random order

    So the behavior & order you see would depend on this.

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

Sidebar

Related Questions

I just began looking into source control.... And installed subversion from collabnet... I also
I am looking into how to write a paint program that supports undo and
I have just been looking into Linq with ASP.Net. It is very neat indeed.
How would you test this scenario? I've just started looking into NHibernate and having
Just some days ago I started looking into a unit test framework called check,
I am just looking at sorting an NSArray of NSNumbers into numeric order but
I was just going to use the FileUpload.FileBytes property but looking into the respective
Just looking for the first step basic solution here that keeps the honest people
I've been looking into memory management a lot recently and have been looking at
NOTE: Originally had this listed as a memory leak. After looking into this deeper,

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.