Solved

Auto Array in C++ ?

Posted on 2003-10-25
1
1,241 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 40 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

617 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