+ 3

Does this program passes array to function by value or by reference?

https://code.sololearn.com/c9nwte925Nt7/?ref=app if it's by reference how to pass it by value and vice-versa

22nd Jul 2018, 9:43 AM
‎ ‏‏‎Anonymous Guy
6 ответов
+ 3
Check out this article. I've never done it in C, but have done it many times in VBA https://beginnersbook.com/2014/01/c-passing-array-to-function-example/
22nd Jul 2018, 10:05 AM
Duncan
Duncan - avatar
+ 3
you don't have to put extra effort to pass array as reference....it's by default passed as reference even if you follow pattern of passing as value
22nd Jul 2018, 10:05 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 3
Thanks Ketan Lalcheta. Duncan i guess i can use your idea. i need to complete my assignment :P
22nd Jul 2018, 10:16 AM
‎ ‏‏‎Anonymous Guy
+ 1
one cannot pass array by value..it's always pass by reference
22nd Jul 2018, 9:50 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Ketan Lalcheta i have an assignment where i'm supposed to pass array by value. So what do i do?
22nd Jul 2018, 9:52 AM
‎ ‏‏‎Anonymous Guy
+ 1
it's passed as reference only...that is the reason you are getting updated values in main function after function call as well... one can not pass array as pass by value for array
22nd Jul 2018, 10:03 AM
Ketan Lalcheta
Ketan Lalcheta - avatar