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 |
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
Differentiate between #include<...> and #include '...'
How can draw a box in cprogram without using graphics.h header file & using only one printf(); ?
How to implement call back functions ?
Write a program for finding factorial of a number.
What is line in c preprocessor?
When is an interface "good"?
main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); }
What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these
how to build a exercise findig min number of e heap with list imlemented?
To what value do nonglobal variables default? 1) auto 2) register 3) static
Write a program using bitwise operators to invert even bits of a given number.