While other variables in the procedure get pushed onto and
popped off the stack dynamically, a static variable in C gets allocated to a fixed memory location, and so the
address associated with the variable name remains static. Static variables in C are used for things like counters,
when one must keep track of the number of times a procedure has been executed. A static variable will allow
the count to persist between calls to the procedure.
For OO programming, and specifically for Java, think of static members as shared members. Static members
are accessible to all. Understand how they differ from instance members, and use static members only when
they satisfy a need that a corresponding instance member cannot.
SCRIPTING LANGUAGES
Today there is a large set of programming languages collectively referred to as scripting languages.
The original idea of a ???script??? was a set of operating system commands placed in a file. When a user ???executes???
the script file, the set of commands in the file is executed in order. This notion of a script is still heavily used.
Scripts are very useful for automating routine tasks which otherwise would require a person to sit at a keyboard
and type the same commands again and again.
Pages:
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156