To: Curtiss Cicco <1CMC3466 AT ibm DOT mtsac DOT edu> Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Undeclared string variable Date: Thu, 22 Dec 94 08:39:35 +0200 From: "Eli Zaretskii" > 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 > > 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!