Hi y'all :>> I'm new to this app, I'd like to ask, how to pass an array in a user-defined function in c++?? thanks! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi y'all :>> I'm new to this app, I'd like to ask, how to pass an array in a user-defined function in c++?? thanks!

17th Mar 2022, 7:59 AM
Chl Smlln
3 Answers
0
Use pointer of the type of array you want to pass that should do it
17th Mar 2022, 12:50 PM
Deba Shankar Pati
Deba Shankar Pati - avatar
0
Like if you want a integer array to pass then you can say void fun(int * arr) and you will be able to access index wise inside the function similar to outside.
17th Mar 2022, 12:52 PM
Deba Shankar Pati
Deba Shankar Pati - avatar