Path: chuka.playstation.co.uk!dialup-07-01.netcomuk.co.uk!user From: shad.dev@netcomuk.co.uk (Ira Rainey) Newsgroups: scee.yaroze.programming.codewarrior Subject: Re: declaring variables Date: Sat, 21 Jun 1997 21:57:59 +0100 Organization: shadow developments Lines: 26 Message-ID: References: <33ABCD3F.9834F05@mail.globalnet.co.uk> NNTP-Posting-Host: dialup-07-01.netcomuk.co.uk X-newsreader: MT-NewsWatcher 2.2.2 In article <33ABCD3F.9834F05@mail.globalnet.co.uk>, Brian West wrote: > I was wondering if you could tell me while the following doesn't work in > Codewarrior but works in VC++5/Watcom > > void main() > { > int a; > a=5; > int b; > b=7; > } > > this gives an unidentified declarator b error message unless I put 'int > b;' after 'int a;' or I write 'int a,b;' It doesn't seem to like any > staements being put in between declaring variables. Probably due to strict ANSI C compliance. You cannot define variables after you have started to write any other code. This is only legal in C++, not in ANSI C. Ira -- "The difference between the impossible and the possible lies in determination" -- Tommy Lasorda