delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/16/11:46:15

From: Charles Krug <charles AT pentek DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: parse errors
Date: Thu, 15 Jan 1998 09:31:23 -0500
Lines: 27
Message-ID: <34BE1DBB.BC64D0D6@pentek.com>
References: <19980115130300 DOT IAA15160 AT ladder01 DOT news DOT aol DOT com>
NNTP-Posting-Host: mail.pentek.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

HackerOC3 wrote:

>printf("y value?");
>int y;
>scanf(" %d", &y);
>printf("color value?");
>int c;
>scanf(" %d", &c);

> In above code, i get parse errors before int.  I also sometimes get parse
> errors in function prototypes for seemingly invaild reasons.  Please help!!
>

C is not C++.  You must declare your variables at the top of your scope.

{
    int y, c;
    printf("y value?");
    scanf(" %d", &y);
    printf("color value?");
    scanf(" %d", &c);
}

--
Charles Krug, Jr.


- Raw text -


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