Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <slrnvjrll7.fkp.dan@djph.net>
Deutsch   English   Français   Italiano  
<slrnvjrll7.fkp.dan@djph.net>

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

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Dan Purgert <dan@djph.net>
Newsgroups: comp.lang.c
Subject: Re: else ladders practice
Date: Wed, 20 Nov 2024 12:31:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <slrnvjrll7.fkp.dan@djph.net>
References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org>
 <slrnvi746p.fkp.dan@djph.net> <else-20241116103316@ram.dialup.fu-berlin.de>
Injection-Date: Wed, 20 Nov 2024 13:31:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="287869a05dfc632aac69abc864ee361f";
	logging-data="106895"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+Gdu2nlo0zAQRSz7W0gW3BmZE059tWWBI="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:wVhBUTywPdksRMmRCiR5lU+c3Ls=
Bytes: 2645

On 2024-11-16, Stefan Ram wrote:
> Dan Purgert <dan@djph.net> wrote or quoted:
>>if (n==0) { printf ("n: %u\n",n); n++;}
>>if (n==1) { printf ("n: %u\n",n); n++;}
>>if (n==2) { printf ("n: %u\n",n); n++;}
>>if (n==3) { printf ("n: %u\n",n); n++;}
>>if (n==4) { printf ("n: %u\n",n); n++;}
>>printf ("all if completed, n=%u\n",n);
>
>   My bad if the following instruction structure's already been hashed
>   out in this thread, but I haven't been following the whole convo!

I honestly lost the plot ages ago; not sure if it was either!

>
>   In my C 101 classes, after we've covered "if" and "else",
>   I always throw this program up on the screen and hit the newbies
>   with this curveball: "What's this bad boy going to spit out?".

Segfaults? :D

>
>   Well, it's a blue moon when someone nails it. Most of them fall
>   for my little gotcha hook, line, and sinker.
>
> #include <stdio.h>
>
> const char * english( int const n )
> { const char * result;
>   if( n == 0 )result = "zero";
>   if( n == 1 )result = "one";
>   if( n == 2 )result = "two";
>   if( n == 3 )result = "three";
>   else        result = "four";
>   return result; }
>
> void print_english( int const n )
> { printf( "%s\n", english( n )); }
>
> int main( void )
> { print_english( 0 );
>   print_english( 1 );
>   print_english( 2 );
>   print_english( 3 );
>   print_english( 4 ); }

oooh, that's way better at making a point of the hazard than mine was.

.... almost needed to engage my rubber duckie, before I realized I was
mentally auto-correcting the 'english()' function while reading it.


-- 
|_|O|_| 
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1  E067 6D65 70E5 4CE7 2860