why array index always starts from zero??

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of function is main ()?

583


Difference between goto, long jmp() and setjmp()?

704


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

3652


What are reserved words?

652


given post order,in order construct the corresponding binary tree

2321






what is a NULL Pointer? Whether it is same as an uninitialized pointer?

758


What is the difference between array_name and &array_name?

774


Give the rules for variable declaration?

669


Which is better oop or procedural?

628


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1011


What is preprocessor with example?

579


What is variable in c example?

590


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1779


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

597


What is the use of bit field?

635