+4

Why the output hello_world ? and not llo_world

https://code.sololearn.com/cezZVmX9L8Yq/?ref=app

12/3/2019 8:23:02 PM

Hima

9 Answers

New Answer

+3

Yes, if you don't dereference, you change the value (address) stored in param, not the value the address points to.

+2

The thing is this: You want to change the original pointer, right? You pass a pointer TO the pointer to the function. So if you don't dereference in the function, you change the pointer to the pointer itself, not the pointer it is pointing to. It is the same with when you want to change an int: void f(int *n) { // We need to dereference ++*n;

+2

HonFu ty

+1

This seems to work: void myfunc(char** param) { ++*param; }

+1

HonFu what's wrong with This code?

+1

You are not dereferencing param in the function. If you change it to what I wrote, it works.

+1

HonFu Is it call by value?

+1

HonFu Does if mean we are just changing the address of param?

-1

Recheck your code bro