[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] That was productive...



* Larry Rosler (lr@hpl.hp.com) [000118 14:07]:
> 
> Quite unlike Perl, the type of an array in C
> includes its size, which is statically compiled.
> 
> So to find the number of elements in the array a,
> 
>     sizeof(a) / sizeof(a[0])
> 
> And the index of the last element is one less than that.

Of course, this only works for static and automatic
variables, not for dynamic ones.
(Or am I wrong?  And who cares?  ;-)

-- 
John Porter

"There are people who have fun studying the C++ spec for
literally seconds on end, I'm sure..."    John Vlissides


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe