Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jan 2001 16:13:53 -0700
From:      Greg Skafte <skafte+freebsd-chat@trollkarl.net>
To:        freebsd-chat@freebsd.org
Subject:   C Puzzle
Message-ID:  <20010128161353.C98223@trollkarl.skafte.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010128161353.C98223>