On Tue, 25 Sep 2007 15:05:34 GMT,
(Richard
Bos) wrote in comp.lang.c:
> Sikandar <> wrote:
>
> > I am beginner in C. Pls let me know what is packed array in C.
>
> There is no such thing in ISO C. Any packed array extensions you may
> encounter are compiler-specific, and not portable. If you want a
> language where you can pack arrays portably, I believe Pascal lets you
> do so.
>
> Richard
Indeed it does, but it doesn't do what many people, apparently
including you, seem to think.
In the old, old days, implementations of many languages often wasted
memory by allocating a machine word to every element of an array, even
if a machine word was 32 or 36 or60 bits, and the elements of the
array were of a type that required far fewer bits. Hence the Pascal
"packed array" of characters.
That would be equivalent to a plain old ordinary array of
((un)signed)char in C.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html