Can't tell. send soil samples. you need to send the snippets of code. Most likely, buffer is declared either as a local variable or as static in the first or second file/function or bot. Therefore you really have two variables named buffer, not one. bug On Thu, 18 Mar 1999, compiler wrote: > Why does this happen? : I send a char * to a function and if certain > conditions are true, it is assigned NULL and then returns from that > function, but when I check to see if it's NULL, I find out that it's back > to what it was before! Why? Here's the gdb snapshot to show what I am > talking about. > > 52 ptr = strstr(haystack,needle); <-- This is suppose to return NULL > 1: buffer = 0x804aa80 "" <-- What it starts out as > (gdb) next > 53 if (ptr == NULL) { > 1: buffer = 0x804aa80 "" > (gdb) print ptr > $1 = 0x0 > (gdb) next > 54 buffer = NULL; > 1: buffer = 0x804aa80 "" > (gdb) next > 55 return; > 1: buffer = 0x0 <-- Right. > (gdb) next > 83 } // END FUNCTION > 1: buffer = 0x0 <-- Still OK. > (gdb) next > main () at sendmessage.c:177 > 177 if (buffer == NULL) { > (gdb) print buffer > $2 = 0x804aa80 "" <-- It changes back! > (gdb) > > >