[comp.lang.c] Strcpy on SysV vs. BSD.

guy@auspex.auspex.com (Guy Harris) (09/03/90)

>Heavens, you've made one of the most common blunders made by novice C
>programmers.

Or, to put it another way, "just because routine 'foobar()' is defined
as taking a 'char *' as an argument doesn't mean:

1) what you pass to it has to be a variable declared as a 'char *'

or

2) that you can just pass it any random variable declared as a 'char
   *'."

I suspect the reason some novice C programmers make this blunder is that
they see something like

	int stat(path, buf)
	char *path;
	struct stat *buf;

in the manual, and think "ok, I have to declare a 'struct stat *' to
pass to 'stat()'," and do something such as

	struct stat *buf;

	...

	if (stat("my_file", buf) < 0)
		...