Deutsch   English   Français   Italiano  
<875xk5v1td.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Suggested method for returning a string from a C program?
Date: Wed, 19 Mar 2025 01:53:34 -0700
Organization: None to speak of
Lines: 21
Message-ID: <875xk5v1td.fsf@nosuchdomain.example.com>
References: <vrd77d$3nvtf$2@dont-email.me>
	<slrnvtkrqc.ii1.ike@faeroes.freeshell.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Wed, 19 Mar 2025 09:53:42 +0100 (CET)
Injection-Info: dont-email.me; posting-host="6b2adc3539d30183fea78a893643ef1f";
	logging-data="533016"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+sfgpWeUAGcvfNPC+UmwLr"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:6UNYhoLwadjkugTURHI/rvCDPSI=
	sha1:PrwVWsgxOWuhEQrynHCHwT/pJ5E=

Ike Naar <ike@sdf.org> writes:
> On 2025-03-19, DFS <nospam@dfs.com> wrote:
>> I'm doing these algorithm problems at
>> https://cses.fi/problemset/list/
>>
>> For instance: Weird Algorithm
>> https://cses.fi/problemset/task/1068
[...]
> What happens if the input is a negative number?

The problem statement says n is a positive integer.

I've been playing with some of these myself.  I'm actually using
scanf() for integer input, something I wouldn't do in normal code
(because the behavior is undefined if the scanned value is out
of range).  This is a rare case where it's safe to assume that
stdin has nothing harmful.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */