TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-11-11 08:30:18
subject: Special Requests

BL> Does a static array persist after the function has been called?

PE> Yes.

BL> How strange. You call a function, close the function, and the data
BL> stays... sort of like global data on demand. How do you get rid of it?

You can't.

BL> Why not make it global? That would obviate the need to pass pointers
BL> to pointers and save a step.

BL> How does it know one "names" from the next one?

PE> There's only the one. In that function, anyway.

BL> It's memory that stays clogging up the system after the use for it
BL> has gone, but can only be accessed by the function you're no longer

You might call the function again.

BL> using. Great idea. Has C got many like that? Why not just make it
BL> global?

Well, once you start using global variables you have to name them so that
no other module uses that same name.  Declaring them static local means
that you can name them whatever you want.  BFN.  Paul. 
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.