TCS
Company
Programming
Arrays
Which of the following gives memory address of the first element in array?
1)array(2); 2)array[1]; 3)array[0]; 4)array;
Read Solution (Total 5)
-
- array;
as without index any array will give the memory address of the element. - 4 years agoHelpfull: Yes(4) No(2)
- To get the address of ith index of an array, we use following syntax (arr + i). So as we need address of first index we will use (arr + 0) equivalent to arr.
- 3 years agoHelpfull: Yes(1) No(0)
- 3) array[0]
- 3 years agoHelpfull: Yes(1) No(0)
- As the indexing will start from 0 in the array,so to get the index of the first element in array we use array[0]
option 3 is correct answer - 3 years agoHelpfull: Yes(1) No(0)
- Array indexing starts from 0 so answer is 3) array[0]
- 3 years agoHelpfull: Yes(1) No(0)
TCS Other Question