www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/22/02:22:54

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" <eliz AT is DOT elta DOT co DOT il>

>       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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019