why array index always starts from zero??
Answers were Sorted based on User's Feedback
It uses the concept of Binary digits. Take an array size of 64 for example. We start from 0 and end at 63,
We require 6 bits.But, if we were to start from 1 and end at 64, we would require 7 bits to store the same number,
thus increasing the storage size.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / bijayalaxmi behera.
The index of an array is an OFFSET from the beginning of the
array, multiplied by the width of the array items:
Say an array of integers, 4 bytes long.
Say beginning of array at address 0x1000
First integer address: BaseAddress + (index * len) = 0x1000
+ ( 0 * 4) = 0x1000
Second integer will be at : 0x1000 + ( 1 * 4 ) = 0x1004.
| Is This Answer Correct ? | 4 Yes | 6 No |
Answer / nobody special
because starting from 3 would just be silly?
| Is This Answer Correct ? | 1 Yes | 9 No |
CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.
How can I read a directory in a c program?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know???????????
What is the difference between fread and fwrite function?
Explain Basic concepts of C language?
Toggle nth bit in a given integer - num
write a program which counts a product of array elements lower than 10.
Why is event driven programming or procedural programming, better within specific scenario?
Explain how can I open a file so that other programs can update it at the same time?
What is the explanation for modular programming?
to find the program of matrix multiplication using arrays