From owner-freebsd-chat Sun Jan 28 15:14:18 2001 Delivered-To: freebsd-chat@freebsd.org Received: from mage.trollkarl.net (fw.trollkarl.net [207.167.5.66]) by hub.freebsd.org (Postfix) with ESMTP id EC3DC37B400 for ; Sun, 28 Jan 2001 15:13:59 -0800 (PST) Received: from trollkarl.skafte.org (root@trollkarl [192.168.100.16]) by mage.trollkarl.net (8.11.1/8.11.1) with ESMTP id f0SNDsH39031 for ; Sun, 28 Jan 2001 16:13:54 -0700 (MST) (envelope-from skafte@trollkarl.net) Received: (from skafte@localhost) by trollkarl.skafte.org (8.11.1/8.11.1) id f0SNDr098317 for freebsd-chat@freebsd.org; Sun, 28 Jan 2001 16:13:53 -0700 (MST) (envelope-from skafte) Date: Sun, 28 Jan 2001 16:13:53 -0700 From: Greg Skafte To: freebsd-chat@freebsd.org Subject: C Puzzle Message-ID: <20010128161353.C98223@trollkarl.skafte.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: Gregs Hidey Hole Disposition-Notification-To: skafte@trollkarl.net Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I have two code fragments doesn't work : char* fn_mtrim __P((char*)); char* fn_mtrim (s) char* s ;{ short i=0; char *buffer= (char *) calloc (256,sizeof(char)); while (*s){ ( *s == ' ') ? s*++ : buffer[i++] = *s++ ; }; return buffer; } works : char* fn_mtrim __P((char*)); char* fn_mtrim (s) char* s ;{ short i=0; char *buffer= (char *) calloc (256,sizeof(char)); while (*s){ ( *s != ' ') ? buffer[i++] = s*++ : *s++ ; }; return buffer; } Why does the first one not work and the second one work .... -- Email: skafte@trollkarl.net ICQ: 93234105 #575 Sun Life Place * 10123 99 Street * Edmonton, AB * Canada * T5J 3H1 -- -- When things can't get any worse, they simplify themselves by getting a whole lot worse then complicated. A complete and utter disaster is the simplest thing in the world; it's preventing one that's complex. (Janet Morris) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message