TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: andrew clarke
date: 1996-06-09 06:19:20
subject: free()

22 May 96 20:17, Frank Adam wrote to All:

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

#include 

char *myAlloc(void)
{
    char *p;
    p = malloc(80);
    return p;
}

int main(void)
{
    char *ptr;
    ptr = myAlloc();
    free(ptr);
    return 0;
}

--- Msged/2 3.36ac alpha 1
* Origin: Blizzard of Ozz, Melbourne, Australia (3:635/727.4{at}fidonet)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 728 711/401 409 410
SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/727 544 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™.