prev up next   top/contents search

comp.lang.c FAQ list · Question 7.3b

Q: I just tried the code

char *p;
strcpy(p, "abc");
and it worked. How? Why didn't it crash?

A: You got lucky, I guess. The memory randomly pointed to by the uninitialized pointer p happened to be writable by you, and apparently was not already in use for anything vital. See also question 11.35.

Additional links: longer explanation, another longer explanation

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North