From owner-freebsd-questions Fri May 19 15:47:27 2000 Delivered-To: freebsd-questions@freebsd.org Received: from snoopy.brwn.org (intgw1.brwn.org [196.28.127.66]) by hub.freebsd.org (Postfix) with ESMTP id 6523237B9F1 for ; Fri, 19 May 2000 15:47:22 -0700 (PDT) (envelope-from willem@brwn.org) Received: from brwn.org (grumpy.brwn.org [192.168.1.10]) by snoopy.brwn.org (Postfix) with ESMTP id 9DCCA3ACA; Sat, 20 May 2000 00:47:17 +0200 (SAST) Message-ID: <3925C475.E0D8CDC4@brwn.org> Date: Sat, 20 May 2000 00:47:17 +0200 From: Willem Brown Organization: Brwn.ORG X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.13 i586) X-Accept-Language: en MIME-Version: 1.0 To: Gustavo Vieira Goncalves Coelho Rios Cc: questions@freebsd.org Subject: Re: strange error References: <3925C207.789AC2AA@tdnet.com.br> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Gustavo Vieira Goncalves Coelho Rios wrote: Hi, It core dumps if that is what you mean. Changing printf("%s\n", *dir); - to - printf("%s\n", dir); seems to fix the problem. Regards Willem Brown > > What is the problem with this code. I simply can't figure out: > > #include > #include > > char *a(char *); > void t(char *); > > /* You should call it with at least one parameters, ex: > ./a.out test > */ > > void > main(int argc, char *argv[]) > { > char *dir; > > ++argv; > printf("%s\n", *argv); > > dir = a(*argv); > t(dir); > > printf("%s\n", *dir); =========================^ printf("%s\n", dir); > } > > void > t(char *a) > { > while (*a) > *a++ = '1'; > } > > char * > a(char *b) > { > return strdup(b); > } > > -- > Your mouse has moved. > Windows NT must be restarted for the change to take effect! > > Reboot now? [ OK] > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- |--------------LINUX & *BSD, the CHOICE is yours--------------| To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message