View Single Post
Old May 23rd, 2006, 6:22 AM   #5
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,253
Rep Power: 5 grumpy will become famous soon enough
You might want to have a look at Dawei's page on pointers, here. Among other things, this page explains that declaring a pointer only declares the pointer. It does not magically, implicitly, or otherwise create something for that pointer to point at.

Or, to put it another way, if you don't explicitly initialise your pointer, it points at a random area of memory. So copying data to it (which strcpy() does to its first argument) is incredibly dangerous.
grumpy is offline   Reply With Quote