TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: John Gardeniers
date: 1996-05-25 10:32:08
subject: Re: free()

-=> On 22 May 96  20:17:04 <=-
-=> Frank Adam was heard to tell All <=-

        Hi Frank,

 FA> Could someone tell or show me how to free dynamically allocated
 FA> memory in one function from another function or main ?

 FA> eg:
 FA> main()
 FA> {
 FA> foo();
 FA> }
 FA>
 FA> char* foo()
 FA> {
 FA> char *s = malloc(80);
 FA> }

        Is S local or global?  If it's global you shouldn't have any
trouble accessing it from main.  If it's not then why not?  I figure that
would solve your problem rather well.  Because you're trying to access S
from more than one function it really should be global.

                John

... I'm just moving clouds today; tomorrow I'll try mountains.
---
* Origin: Melbourne PC User Group +61-3-9699-6788 (3:632/309)
SEEN-BY: 3/103 50/99 620/243 623/630 632/50 107 108 309 348 360 371 504 525
SEEN-BY: 632/530 533 562 633/371 634/388 396 635/301 502 503 506 544 639/252
SEEN-BY: 711/401 409 410 413 430 808 809 932 934 712/515 713/888 714/906
SEEN-BY: 800/1
@PATH: 632/309 107 635/503 50/99 711/808 934

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™.