why is it giving wrong answer?
Tree right view
@akankshaanand99
hello Akansha,
pass max_variable as refernce or pointer rest evrything in ur code is correct.
and why do I need to do that? I don’t understand.
in ur code u are passing max_level by value which means a copy of max_level is sent due to which whatever changes u will make will be done on the copy of max_level only ,it will not reflected in actual max_level.
in order to to make changes in actual max_level we are passing it as refernce.
also do checkout difference between pass by value and pass by reference
okay okay I understand now.