How to pass a multidimensional array to a functoin? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to pass a multidimensional array to a functoin?

I have an array arr[x][y] and a function printArray(); The values of x and y are set in main() before the function gets called. What is the easiest way to pass the array to the function?

29th Nov 2016, 10:54 AM
jose_2000_
jose_2000_ - avatar
2 Answers
0
use pointer like this one void foo(int *a); Pointers explanation: https://www.facebook.com/groups/akisosd/permalink/327623627623537/?comment_id=327624397623460
29th Nov 2016, 1:14 PM
Muhammad Rizwan
Muhammad Rizwan - avatar
0
datatype arr_name [size 1][size 2]={var 1 ,var 2,......var n};
27th Dec 2016, 3:48 PM
Santosh Dussa
Santosh Dussa - avatar