when i pass an array into a function such as selection sort then the value of the changed array is also reflected in the main function
whereas
when i pass an integer into a function and swap its value it is not reflected in the main function until I use call by reference.
why so?
Value returned by a function in case of an array and integer
this is because arrays always pass by reference
because when we pass array we write FunctionName(arr,n)
and arr is actually a address (Name of array is address)
you try this by printing arr (cout<<arr;) for integer array you get address but not for character array
this is because of cout it treat in this way