On 5/30/07, chipaug <[EMAIL PROTECTED]> wrote:
>
> In Chapter 0 of "Accelerated C++" the authors speak of results and side
> effects. I'm having some difficulty in distinguishing between them.


int i, j=5;

i = printf("%d", j++);

Result: i  = 1 (number of characters printed)
Side effect: j = 6 (i.e. it's incremented)

Also, on page 6 in Chapter 0, under the heading of "Braces and
> semicolons," there is this sentence. "The expression is optional;
> omitting its results in a null statement, which has no effect." I do
> not understand this sentence.


Need more context - what expression? A null statement is something that
doesn't do anything; a lone semicolon or an empty set of braces are both
null statements:

for(int i=0; i<10; i++){
}

for(int i=0; i<10; i++)
   ;

Are equivilant.


-- 
PJH
"I contend that we are both atheists. I just believe in one fewer god than
you do. When you understand why you dismiss all the other possible gods, you
will understand why I dismiss yours."
-- Stephen Roberts


[Non-text portions of this message have been removed]

Reply via email to