I was reading through my text book in the function call stack section and came across this:
the activation record tells main how to return to the operating system (i.e., transfer to return address R1) and contains the space for main's automatic variable (i.e., a, which is initialized to 10)
this was news to me, so my questions are:
- is an automatic variable created?
- what is its purpose?
- is its value always the same?
thanks in advance
That passage refers to a sample program in your text book. In that sample program, an automatic variable named
a
is declared and initialized to 10.The sample program might look like this:
Only if you declare one.
The passage describes ordinary automatic variables that you use in your program, for your own purpose.
No.