Date: Thu, 9 May 1996 00:39:01 +0400 (MSD) From: "Alexander V. Lukyanov" Message-Id: <199605082039.AAA15807@video.yars.free.net> To: justin AT yoss DOT canweb DOT net, wank AT uebemc DOT siemens DOT de Cc: djgpp AT delorie DOT com Subject: Re: vararg > From: Justin Ward > > On Wed, 8 May 1996, Rainer Wank wrote: > > > void abc(int anzahl, unsigned char abc, ...) > > { > > va_list ap; > > va_start(ap, abc); > > fg = va_arg(ap, unsigned char); > > printf("\n\rErster variabler Parameter: %d", fg); > > va_end(ap); > > } > > You are taking fg as a char, but printing it as an int. With djgpp, and > int is 4 bytes and a char is either two or one (I think), depending on > whether you're compiling as C or C++. On the sun and on bc 3.1, a char > and an int are both 2 bytes it seems. I can't say for sure regarding the > sun, but I know this is the case regarding bc. Anyway, just rewrite your > printf using %c instead of %d and everything will be fine. No, this is wrong. char is 1 byte in djgpp and it is automatically converted to int when passed as a parameter.