answersLogoWhite

0


Best Answer
Answer
Unfortunately your question is to broad. All progamming languages vary in the way things are done. I will just give a general way of doing it.
You have to pass the multidimensional array into the function by including it with calling the function. On the receiving end you have to declare another multidimensional array so the information can be passed into it. Depending on the language, you may not be passing in a multidimensional array, instead that array may be stored in an object which you can pass instead.
Hope this helps some.



-Ashat-
in C, when passing two dimensional arrays the compiler needs to know the width so it can calculate memory offsets.

passing a 2d array of width 4:

void
Func(type array[][4]);
User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

In C, arrays are always passed by reference. This is, if you have an array value, and you pass it as the argument to a function, you are actually passing a pointer to the first element in the array, and modifications to the array from inside the function will be seen by the caller.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

In C, all arrays implicitly convert to a pointer at the slightest provocation. As such, it is not possible to pass arrays by value (arrays cannot be copy-constructed), they must be passed by reference. Thus to accept an array, the function argument must be a pointer of the appropriate type. In cases where the size of the array cannot be deduced from the pointer alone, you must also pass the size of the array. Exceptions include null-terminated arrays, such as a null-terminated character array (a string), because the null-terminator marks the end of the array thus the size (if required) can be deduced.

In C++, we can pass arrays as objects, both by value and by reference. The standard template library provides three templates for arrays: std::array for fixed-length arrays; std::vector for variable-length arrays; and std::valarray for one-dimensional numeric matrices. We can also use C-style arrays as per C.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you pass an array as a parameter?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What if you do not provide the string array as the argument to the method?

Actually speaking - Nothing. The Java program will start running. The args is just an optional parameter and you can pass it if you want and ignore it if you dont want to pass any runtime arguments


Can you pass the object as parameter?

But of course.


How do you pass structures as a parameter to the functions in c plus plus?

Put their names into the parameter-list.


How do you pass the parameter in applet?

If you have the function main()... You can use its arguments to pass information.


One of strategy in programming a form of parameter transmission in which a copy of value of a parameter is sent to procedure...what is it?

pass by value


What is an example of array?

argv, which is the second parameter of function mainint main (int argc, char *argv[])


How to pass the parm parameter in PL1?

In JCL it would be of the form exec pgm=mypgroam, parms="/B" where the info after the "/" is the parameter strring.


When is it better to pass an entire array of data to a function rather than individual elements?

It is better to do this when the function needs to work on the entire array, rather than on individual elements. However, do not pass the array by value; always pass by reference.


What is the term used for the variable that receives an argument that pass into a module?

parameter


What is the easiest way to pass arrays as argument in c?

the simple and efficient way to pass an array is pointer to an array like that int (*p)[30] ; // pointer to an array of integer having 30 element


How is an array name interpretedwhen it is passed to a function?

An array is still an array, regardless of how you pass it into functions. It is still an array-type variable at the beginning of a function. However, the function itself may manipulate the array by "imploding" it into a string with a delimiter, using array values with only specific keys, and such.


Is it possible to pass a portion of an array to a function?

Yes. Since passing arrays is a special use of call by reference, simply pass the address of the sub array instead of the primary array. int a[10] = { ... }; myfunction (a); // pass the first element's address myfunction (&(a[3]); // pass the fourth element's address