Today I was at #gnome-hackers asking about pointers, memory leaks and other C things. As always an enormous amount of positive feedback was the result.
I said that I would publish the log to help any other unfortunate C novice, and then Alex Jones resumed all the IRC conversation:


Alex Jones: hey
Diego: hey
Alex Jones: i dunno whether this has clicked with you
Alex Jones: but you understand how in many scoped languages if you do like
Alex Jones: { foo = "bar"; }
Alex Jones: then outside of the } the foo is deleted
Diego: aha
Alex Jones: well really, when you do something like
Alex Jones: { char *foo; foo = whatever(); }
Alex Jones: you have a variable called "foo", which is defined in memory to be POINTING to a piece of data that is a "char"
Alex Jones: so really all that "foo" actually is
Alex Jones: is a memory address
Diego: aha
Diego: and *foo is the value of that memory
Alex Jones: YES
Alex Jones: now also
Alex Jones: whatever() is a function that returns a char*
Alex Jones: i.e. a POINTER to char data
Alex Jones: so really all that function actually returns is a number (i.e. the memory address)
Alex Jones: and again, this goes into "foo", ok?
Alex Jones: (obviously, before the function returns, it puts its string data in the memory it returns a pointer for)
Diego: aha
Alex Jones: so what happens by the end of that function is that "foo" goes out of scope
Alex Jones: and the pointer gets deleted
Alex Jones: so the number is gone
Alex Jones: but the data still exists there
Diego: aha
Alex Jones: what i find confusing about the way the GNOME guys do C is that they do like "char *foo"
Alex Jones: which makes it look as if "*foo" is the variable
Alex Jones: when it’s not
Alex Jones: "foo" is the variable
Alex Jones: char* is its type
Alex Jones: if you look at it that way, this whole thing about scope etc. makes a lot more sense
foo is just another variable, it’s of type pointer-to-char :)
Alex Jones: i hope that helps you a bit


Hope it helps someone, if I can I’ll try to translate it to Spanish.