line 4: error: declaration of 'ary1' as array of reference
line 25: error: 'aryl' was not declared in this scope
line 25: error: expected primary-expression before ']' token
line 35: error: declaration of 'ary1' as array of reference
line 40: error: 'ary1' was not declared in this scope
line 40: error: expected primary-expression before ']' token
is there anyway to pass the array back to the main function?
When you just use the name of the array to pass it as a parameter, it is assumed to be a pointer to the first element. Therefore, you will be modifying the actual array; no need for references. The problem is the when you use the & like that you are basically declaring an array of "references to ints" which you can't do.
when you call het ary-function, you have te write this: ary(arty1).
the function takes a pointer te the first element, thats why. if you write this: ary(ary1[]) then you pass the content of ary1 on index 0.