Solved

Auto Array in C++ ?

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

751 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