TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple C Question



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