Deutsch English Français Italiano |
<vre5gt$jkpr$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Suggested method for returning a string from a C program? Date: Wed, 19 Mar 2025 10:15:58 +0000 Organization: A noiseless patient Spider Lines: 20 Message-ID: <vre5gt$jkpr$1@dont-email.me> References: <vrd77d$3nvtf$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 Mar 2025 11:15:57 +0100 (CET) Injection-Info: dont-email.me; posting-host="7e795a09c43565574fe5145a3967fadc"; logging-data="643899"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fZLvnSWBnbAwUYoGurA8B" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:u+cCZrjv7pLGPVcSBDEdLjJdPUw= In-Reply-To: <vrd77d$3nvtf$2@dont-email.me> Content-Language: en-GB Bytes: 1631 On 19/03/2025 01:38, DFS wrote: > > I'm doing these algorithm problems at > https://cses.fi/problemset/list/ > > For instance: Weird Algorithm > https://cses.fi/problemset/task/1068 This is related to the Collatz Conjecture. What's weird is not mentioning it. > len = strlen(result); > sprintf(result + len, "%d ", n); And what's odd here is collating the results in a string (especially when the possible number of steps is unknown). Why not just print it straight to the console?