|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
no:brackets are used in array declarations not parentheses.
Create Date
:
Tuesday, April 01, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
Arrays can't be passed by values. Because , the array name is evaluated to be a pointer to the first element of the array. e.g. when we pass array x, its equivalent to &x[0] i.e. pointer to the first element. Its type is, therefore, int *, and a called function uses this pointer (passed as an argument) to indirectly access the elements of the array.
e.g . int main()
{
void function1(int A[],int n);
int x[10],i;
for(i=0;i<10;i++)
{ x[i] = 10;
}
function1(x,10);
}
void function1(int A[],int n)
{ ..../* some processing on the array */
}
In the above example,prototype shows the first formal parameter as an integer array without specifying the size. In C, this syntax is interpreted as a pointer variable; so array A is declared as an int * variable.
This is the unique feature of C is that array access is always indirect; thus making it particularly easy for a called function to indirectly access elements of an array and store or retrieve values.
Create Date
:
Sunday, March 16, 2008
Click here
to improve the Interview Question, Answer and other fields.
|
|
Inappropriate
|
See Answer
To Email:
Subject:
Note to go along with the question: (Optional, no
more than 1,000 characters)
A java.util.ArrayList has the following characteristics over an array:
1. Provides a resizable array implementation
2. Implements the java.util.List interface
3. Has a tuning parameter called initialCapacity which specifies the number of elements the ArrayList can hold before it has to be resized.
Create Date
:
Sunday, March 16, 2008
Click here
to improve the Interview Question, Answer and other fields.