Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/29/03 11:48
Read: times


 
#44482 - RE: data change when passing parameter
Responding to: ???'s previous message
If you are trying to change the value of the pointer (ie the memory location the pointer is pointing to) from within the function you need to pass a 'pointer to the pointer' to the function. Dereferencing this one level will allow you to change the memory location pointed to:

void main(void)
{
char *ptr;

Fn(&ptr);
}

void Fn(char **p)
{
*p++; //Increments pointer in main
}

List of 5 messages in thread
TopicAuthorDate
data change when passing parameter            01/01/70 00:00      
   RE: data change when passing parameter            01/01/70 00:00      
   RE: data change when passing parameter            01/01/70 00:00      
   RE: data change when passing parameter            01/01/70 00:00      
   Clarify the question            01/01/70 00:00      

Back to Subject List