How could i know the total elements an array can store???
whether it depends on the datatype or os(32bit or 64bit)???

Recommended Answers

All 5 Replies

>How could i know the total elements an array can store???
You're guaranteed at least 65535 / sizeof(T) where T is the type of the array. 65535 is the minimum limit for an object in C.

Narue, out of interest what is the convention for this kind of thing? I just found this link which gives the specific sizes for each platform, I'm just intrigued as to why it has to be 2^16 minimum.

>I'm just intrigued as to why it has to be 2^16 minimum.
That's simply the standard's minimum limit for objects. A conforming implementation must support at least that much. The idea is that the minimum limits should support the maximum number of platforms.

Makes sense really; where could I find the standards for this sort of thing? Will probably come in handy over the next couple of months.

This is a free draft for C99. I use it when I don't have my hard copy of the final standard handy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.