Hi,
this is an interesting question a professor asked me in a viva exam.
How can I get the middle element of a bulk array without using a division operator?
It means if my array is of size 100, i will get the 50th element without using the following code snippets .....
Code:
#include<stdio.h>
main()
{
int anArr[100]={5};
printf("%d\n",anArr[(sizeof(anArr)/2)/2]); // using division operator
return 0;
}
please suggest me how to get the middle element without using a division operator.
If someone know more then a solution please do let us know ....
Thanks in advance .............