Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Language%20in%20C%20Interview%20Questions%20and%20Answers

Question: How do I know how many elements an array can hold?

Answer: The amount of memory an array can consume depends on the data type of an array. In DOS environment, the amount of memory an array can consume depends on the current memory model (i.e. Tiny, Small, Large, Huge, etc.). In general an array cannot consume more than 64 kb. Consider following program, which shows the maximum number of elements an array of type int, float and char can have in case of Small memory model.
main( )
{
int i[32767] ;
float f[16383] ;
char s[65535] ;
}
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook