I was confuse I know that ptr=(char*)malloc (sizeof(char*1) here means allocate 1 byte and return a pointer to the allocation then assign to ptr, so ptr is a pointer.
But when it calls func(ptr) why it not use &? Although what I want is to change the character inside ptr points to? Why not using void func(char** ptr) and send func(&ptr) here? Is it possible?
I mean what made this pass by reference and not by value?
Why this not pass copy of the pointer?
Is this mean in func(ptr), i pass pointer which is memory address(malloc) and was define as char*ptr in func?? So thats why it work?