Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Automatic strings without malloc Date: Wed, 17 Nov 2021 11:14:30 -0800 Organization: None to speak of Lines: 15 Message-ID: <87lf1mvbl5.fsf@nosuchdomain.example.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="6adbb48cfacfb1ab527767c44a65f2ee"; logging-data="9314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pMrbr56NRaeSE2eWWEhhQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:FSf/GSAjfc/K+h7a+CWu+8G9MDw= sha1:JluURKiDjw0jRR6IkWriZpZh9r8= Xref: csiph.com comp.lang.c:163450 pozz writes: > Many times I need to construct a string through a call to sprintf and > pass it to an external function. > > char s[32]; > sprintf(s, "Hi %s, today is %d/%d/%d", yourname, day, month, year); > lcd_write(s); I presume that lcd_write() doesn't retain the address passed to it, so the display won't be messed up when the array object s ceases to exist. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */