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 714775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:06:45+00:00 2026-05-14T05:06:45+00:00

The basic pseudo code looks like this: void myFunction() { int size = 10;

  • 0

The basic pseudo code looks like this:

void myFunction()
{

int size = 10;

int * MyArray;

MyArray = new int[size];

cout << size << endl;

cout << sizeof(MyArray) << endl;

}

The first cout returns 10, as expected, while the second cout returns 4.

Anyone have an explanation?

  • 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-05-14T05:06:46+00:00Added an answer on May 14, 2026 at 5:06 am

    MyArray is only a pointer, which on your system, has a size of four bytes.

    When you dynamically create an array, you need to keep track of the size yourself.

    If you created an automatic array or static array,

    int MyArray[10];
    

    then sizeof(MyArray) would be 40. As soon as the array decays to a pointer, though, e.g. when you pass it to a function, the size information is lost.

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

Sidebar

Related Questions

Basic C++ class question: I have simple code currently that looks like something like
I've got a simple Visual Basic 2008 Express Edition form which looks like this:
Basic question here - I have many lines of code that look something like:
I'm not sure how to describe this, but I'll try with some basic code:
I have a class that looks like this: class Record { public string host
I'm in a basic programming class, and everything is done in pseudo code. My
I am absolutely new in Servlet technology and this is absolutely basic question, but
How do I initialise a heap data structure in simple, basic Java pseudo-code with
The Django Basic Inlines app renders a pre-determined template from a pseudo-HTML syntax, based
Basic doubt...If QTP generates vbscript code as we record actions, can't we directly write

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.