TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:10678] Simple C Question
Hello.
I assume that FO_offset is an integer;
#define UPPER_LIMIT 256
int FO_offset = 0;
while (FO_offset += 16 <= UPPER_LIMIT)
printf("%d\n", FO_offset);
Tom Veldhouse
veldy@visi.com
On Wed, 1 Dec 1999, Brian Ackermann wrote:
> Ok, simple question for all you C programmers out there...
>
> Here's the line of code in question...
>
> printf("%s\n", (char *)(FO_Offset+=16));
>
> Assuming FO_Offset=0 at start and this code runs in a loop we should
> see:
>
> 16
> 32
> 48
> 64
> 80
> 96
>
> and so on...
>
> I'm assuming that (FO_Offset+=16) evaluates to an integer value, say,
> 16, in
> the first instance,
> and then casting it to a (char *) will let the printf() do what it
> does.
>
> The program compiles without errors or warnings, but the text is just
> garbage...
>
> What am I missing?
>
> Thanks in advance,
> Brian J. Ackermann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
>