Mail Archives: djgpp/1994/12/22/02:22:54
> In this C book I am working through, I've come to some code that
> won't compile. I get an error msg saying 'str' is undeclared, here's the
> code that is giving me problems:
>
> ------------------------------------------------------------------------
> #include <stdlib.h>
>
> main()
> {
> /* allocate memory for a 100 character string */
> char *string;
> if (( str = (char *) malloc(100)) == NULL)
^^^
Look carefully: the program declares a variable called ``string'',
then uses an UNDECLARED variable called ``str''. The compiler
is damn right complaining about this obscenity.
Boy, do I love these @#$! editors which can't get their job
done as God intended!
- Raw text -