dman wrote: > On Mon, Nov 05, 2001 at 03:42:55PM +0100, martin f krafft wrote: > | * Erik Steffl <[EMAIL PROTECTED]> [2001.11.04 17:20:37-0800]: > | > not sure if it's clear but there's a difference when sizeof's argument > | > is array or pointer:
Yes, a very important thing to understand. int a[10]; int* b = a; "sizeof a" is the size of 10 ints (40 bytes on a 32-bit system). "sizeof b" is the size of a pointer. > | > | yes. which is exactly why i pointed this out. sizeof is a compile-time > | function. that's the main point. > > \begin{nitpick} > IIRC sizeof() is a macro. Anyways, C doesn't have inline > functions so all funcitons are invoked at runtime. > \end{nitpick} No, sizeof is not a macro, nor is it a compile-time function. It's a unary operator evaluated at compile-time. Look it up! Craig