From: rdieter AT math DOT unl DOT edu (Rex Dieter) Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP inconsistencies? - Nope Date: 13 Mar 1997 22:59:17 GMT Organization: University of Nebraska--Lincoln Lines: 27 Message-ID: <5ga0s6$bu2@crcnis3.unl.edu> References: <5g9p1b$fac AT netra DOT montana DOT edu> Reply-To: Rex Dieter NNTP-Posting-Host: mathlab44.unl.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <5g9p1b$fac AT netra DOT montana DOT edu> pv AT cs DOT montana DOT edu (Paul Peavyhouse) writes: > Here is a modified code: > int main (int c, char **v) > { > terra = load_datafile("terra.dat"); > char *str; > } This is illegal in C, but ok in C++ (I believe, where you can declare a variable in the middle of a block). All variable declarations must come first in a block ( {} ). > int main (int c, char **v) > { > char *str; > terra = load_datafile("terra.dat"); > } > ...IT WORKS?!?!?! I can live with writing it this way, but I want This version is correct, so yes, of course it works. (-; -- Rex A. Dieter rdieter AT math DOT unl DOT edu (NeXT/MIME OK) Computer System Manager http://www.math.unl.edu/~rdieter/ Mathematics and Statistics University of Nebraska-Lincoln