when an array is received as a parameter by a function then whatever the dimensions of the array the first subscript is specified with empty braces i.e[ ] why is it so..... what is the implication of such a declaration

int sort(list[][a])
{
/*statements*/
}

Recommended Answers

All 4 Replies

>what is the implication of such a declaration
You are passing a multidimentional array as a parameter. Look here for more information

However it shout be more like:
int sort( data type list[][a])
{
/*statements*/
}

by implication i meant how this empty braces is interpreted by the compiler because one of the dimension required by the compiler is missing......

>because one of the dimension required by the compiler is missing......

Is not missing. The compiler knows already about it.
Read the link that I pointed to you previously and you'll understand.

In simplest terms: Compiler looks at a 2D array as a 1D array that has a 1D array as elements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.