Deutsch English Français Italiano |
<usgjeh$1rnlb$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: vallor <vallor@cultnix.org> Newsgroups: comp.os.linux.advocacy Subject: Re: OT programming challenge: fastest/best/shortest C program to jumble a sentence, then restore it Date: Sat, 9 Mar 2024 03:01:37 -0000 (UTC) Organization: A noiseless patient Spider Lines: 39 Message-ID: <usgjeh$1rnlb$2@dont-email.me> References: <65e9cad3$0$4689$882e4bbb@reader.netnews.com> <l4ufsbF9kdnU4@mid.individual.net> <usf2m9$1n0jh$2@dont-email.me> <l518d6FmepqU1@mid.individual.net> <usfs1a$1svs6$1@dont-email.me> <l520v9FqgibU5@mid.individual.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 9 Mar 2024 03:01:37 -0000 (UTC) Injection-Info: dont-email.me; posting-host="ab4e216fb12235b831fdc816a1885311"; logging-data="1957547"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3a/i+6ntP5r0tbhfxu3sI" User-Agent: Pan/0.155 (Kherson; c0bf34e gitlab.gnome.org/GNOME/pan.git; x86_64-pc-linux-gnu) Cancel-Lock: sha1:tcPmkL4y/AUwJoihEiNTYdMyZMo= X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ Bytes: 2633 On 9 Mar 2024 02:48:10 GMT, rbowman <bowman@montana.com> wrote in <l520v9FqgibU5@mid.individual.net>: > On Fri, 8 Mar 2024 15:22:06 -0500, DFS wrote: > >> FYI: > > Obviously you didn't put it back together after word wrap broke it up. > > gcc -pedantic -Wall -Wcast-qual -Wmissing-prototypes -Wshadow shuffle.c > - o shuffle > > runs with no errors or warnings. If you throw in -std=c99 > > gcc -std=c99 shuffle.c -o shuffle shuffle.c: In function ‘main’: > shuffle.c:8:22: warning: implicit declaration of function ‘strdup’; did > you mean ‘strcmp’? [-Wimplicit-function-declaration] > 8 | char* sentence = strdup("Once you try it, you'll see it > doesn't need spice."); > | ^~~~~~ > | strcmp > shuffle.c:8:22: warning: initialization of ‘char *’ from ‘int’ makes > pointer from integer without a cast [-Wint-conversion] > > Why? you might ask? ISO C99 doesn't include strdup although it's strange > it pulls strcmp out of its ass. What about: char sentence[] = "Once you try it, you'll see it doesn't need spice."; ? > > gcc -std=gnu99 shuffle.c -o shuffle > > works fine. -- -v