Linked list operator overloading

just tell why we are using & in cascading operator

ostream & operator<<(ostream &cout,node*head)

Hello @rupesh-4819 do you know what is the difference between the pass by value and pass by reference .
when we are doing this with &operator that means we are passing it as by reference that means if any change will be made in the function that will be reflected in the orignal link list.
Happy Learning !!

yes i know the difference b/w PBV and PBR but what change we want in istream or ostream to pass it by reference i mean why we can’t just pass it by value (In cout<<head; case we are just printing all values… we are not changing anything nor we want any change) then why we are using “&” or passing by reference…that is my doubt

Hope you understood…

i have not understood what exactly you wan to say but while printing we will pass it by value only.
we will pass it by reference only when we want to make changes.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.