Szabolcs said:
what type can/should be used as array index?
Any integer type is permitted by the C Standard. However in most
situations negative index values might not be needed, so an unsigned
type like unsigned or size_t should be fine.
If you anticipate the need for negative index values use a signed type
like int or long.
Which type is the "best" would depend on your implementation, (including
the characteristics of the underlying architecture), and the context of
use in your program. In one place int might be sufficient while in
another place you might need an unsigned long.
As far as C Standard goes, only the type size_t is guaranteed to be able
to store the size of the largest possible object in a program. It
defined as an unsigned integral type but the exact type is
implementation defined. In most cases it is unsigned or unsigned long.
<snip>