Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Auto Array in C++ ?

Posted on 2003-10-25
1
Medium Priority
?
1,255 Views
Last Modified: 2012-05-04
To C++ Expert :

   What is an auto-array ? Is it the same as static array ? How does it be initialized ? Are they initialized on heap or stack ? Thanks a lot !

meow .....
0
Comment
Question by:meow00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
Mustak_Shaikh earned 160 total points
ID: 9620361
Auto-array is a normal array which we commonly use in C++ or any other language.
it is basically initialize on stack. it is initialize as usual in following way:
int intNum[] = {10,20,90};
it is not same as static array.
A static array is array which is initialized only once i.e.
 void func()
{
        static int intNum[] = {10,20,90};   //line-1
       // other code   //line-2
     //
}
when i call this function for the first time ,only at that time only line-1 will
get executed and for rest of the the function will execute from line-2 onwards.
What it mean is that when ever i am revisiting this function it will retain the last stored value of intNum array, will not destroy this lastly stored value by executing line-1

regards,
Mustak_Shaikh
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question