3 ms·
strpy() is safe when used safely. That means that you've confirmed that the target is big enough. For example, there's no way this can fail: char s[10];
by _kst_ 7y ago
strpy() is safe when used safely. That means that you've confirmed that the target is big enough.
For example, there's no way this can fail:
char s[10];
strcpy(s, "hello");
The problem is that it can also be used unsafely, and except in the simplest cases it's difficult or impossible to tell whether a give usage is safe.
By contrast, gets() (which isn't even in the language anymore) is inherently unsafe, because you can't control what will appear on standard input.