Need help with passing multidimentional array to function. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need help with passing multidimentional array to function.

Hello all. Can anyone help me to the error showing in the following code for "crime_detect function"? I guess it is something with the array. Without function it works fine. https://code.sololearn.com/cMP2S0iwDGgB/?ref=app

20th May 2018, 10:11 AM
Mohammad Nazmul Hossain
Mohammad Nazmul Hossain - avatar
7 Answers
+ 2
You need to use arr instead of log in crime_detect. Log is only defined in main
20th May 2018, 10:36 AM
Max
Max - avatar
+ 1
You are not passing enough arguments to crime_detect and the function signature should be void crime_detect(int a, int arr[][4])
20th May 2018, 10:27 AM
Max
Max - avatar
+ 1
This works for me: void crime_detect(int a, string log[][4])
20th May 2018, 10:37 AM
Max
Max - avatar
+ 1
Good job on solving the challenge
20th May 2018, 10:38 AM
Max
Max - avatar
0
Max Could you see now? still error.
20th May 2018, 10:30 AM
Mohammad Nazmul Hossain
Mohammad Nazmul Hossain - avatar
0
Max I have changed it to srtring array [][4] now... but still error. arr in main is declared as int arr [100]
20th May 2018, 10:36 AM
Mohammad Nazmul Hossain
Mohammad Nazmul Hossain - avatar
0
Opps.. thank you Max . It is working now.. 🤗
20th May 2018, 10:40 AM
Mohammad Nazmul Hossain
Mohammad Nazmul Hossain - avatar