why array index always strats wuth zero?

Answers were Sorted based on User's Feedback



why array index always strats wuth zero?..

Answer / sameer

it because arrays index are pointers and you are giving
offsets from the base pointer & base pointer is starting
element address so it has offset zero from base pointer

Is This Answer Correct ?    11 Yes 3 No

why array index always strats wuth zero?..

Answer / surya.raj

Since I found this questions answer on a another website and
I can do copy and paste from there, but in order to make
copyright and royalty of original poster I am not tending to
do that so, here is the link below from where you can get
answer of your question.

http://developeronline.blogspot.com/2008/04/why-array-index-should-start-from-0.html

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

Who could write how to find a prime number in dynamic array?

1 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }

1 Answers  


plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............

2 Answers   Wipro,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  






main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.

2 Answers   Mentor Graphics, Microsoft,


what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above

2 Answers   HCL,


How to return multiple values from a function?

7 Answers  


main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


Categories