Solved

Auto Array in C++ ?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
linearIn  challenge 23 65
firstChar challenge 13 86
Modify a small python script 19 54
Recommendation vb6 to vb.net or others 14 41
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now