| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Pointers |
Hello Jasen!
02 Sep 03 06:55, you wrote to me:
BS>> Can't i avoid to have a extra pointer?
JB> you could replace sprintf with something that prints and then frees
JB> for you.
JB> void print_n_free(char * s)
JB> {
JB> if(s) {
JB> printf("%s",s):
JB> free(s);
JB> }
JB> }
OH! A good idea! :)
JB> or you could change test to return a static.
JB> char* test(){
JB> static char str[80];
JB> sprintf(str,"test");
JB> return str;
JB> }
JB> theen you won't have to free it...
Greate! :)
Regards,
Bo
--- Squish/Linux v1.12.002 BETA
* 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™.