delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/21/06:19:44

Date: Mon, 21 Aug 2000 12:19:29 +0200 (MET DST)
From: pad2369 <pad2369 AT iperbole DOT bologna DOT it>
Message-Id: <200008211019.MAA25583@maggiore.iperbole.bologna.it>
To: djgpp AT delorie DOT com, Herby <ein_freund AT hotmail DOT com>
References: <39a05374$0$14726 AT SSP1NO25 DOT highway DOT telekom DOT at>
In-Reply-To: <39a05374$0$14726@SSP1NO25.highway.telekom.at>
MIME-Version: 1.0
User-Agent: IMP/PHP3 Imap webMail Program 2.0.11
Sender: pad2369 AT iperbole DOT bologna DOT it
Subject: Re: Error using clrscr()
Reply-To: djgpp AT delorie DOT com

Herby <ein_freund AT hotmail DOT com>:

> Following problem occured:
>
> 1st Pgm.Segment:
> #include <conio.h>
> main()
> {
>         clrscr();
>         printf("Hello");
> }
>
> Result o.k.   No errors
>
> If only another line is added like this:
>
> #include <conio.h>
> main()
> {
>         clrscr();
>          int Zahl;
>         printf("Hello");
>
> }
>
> The following error occurs:
> Error: parse error before 'int'
>
> What is here wrong ?

C does not allow var declaration between two 
statements, you have to put them all at the beginning 
of the function. C++ allows this feature.

If you name your file with .c extension then gcc will
try to compile it using C rules. If you want your file 
to be compiled as C++ you have to name it with a .cpp 
or .cc extension.

ciao
  Giacomo
-----------------------------------------------------
Giacomo Degli Esposti - pad2369 AT iperbole DOT bologna DOT it

- Raw text -


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