TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Bo Simonsen
date: 2003-08-31 23:49:32
subject: Pointers

Hello All!

I've a function here.

char * test()
{
        char * tmp = NULL;

        tmp = (char *) malloc(80);
        sprintf(tmp, "test");

        return tmp;
}

int main()
{
        printf("%s", test());
}

How do i free the memory i allocated for tmp?

Regards,
Bo

--- GoldED+/LNX 1.1.5
* Origin: The Night Express, Roennede Dk (2:236/100)
SEEN-BY: 633/267 270
@PATH: 236/100 237/9 20/11 106/1 2000 633/267

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