Thanks Erik

Erik de Castro Lopo <[EMAIL PROTECTED]> writes:

> The same thing applies to pointers, the pointer is copied and passed
> to the function. However in the function the pointer can be 
> de-references and the dereferenced value modified. Const can prevent
> this. Finally, remember than in C, strings are just pointers to arrays 
> of char.

OK, I think this is where I got tripped up. I couldn't see the
difference between a pointer that gets copied, and ints, etc.

So

int smallest(foo &smallest, const foo f1, const foo f2);

So my understanding is even though f1 and f2 gets copied, because they
can be de-referenced you make them const?

_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to