|
From: <jar...@ig...> - 2002-04-18 10:56:44
|
>>From: "Anon" <an...@pu...>
>>To: <dev...@li...>
>>Subject: [Dev-C++] Ansi compatible?
>>Date: Thu, 18 Apr 2002 11:50:11 +0530
>>
>>Hey!
>>Can anyone please tell me if the following code is ANSI compatible? It
>>compiles fine with DevC++ but throws up an error in Borland 5.0
>>
>>#include <iostream.h>
this should be #include <iostream> but you don;t need it in this
program
>>#include <stdlib.h>
this should be
#include <cstdlib>
using std::system; // since you need the system function from cstdlib
>>
>>int main()
>>{
>> int i=10;
>> int arr[i]; //can it do accept Integer variable
NO, according to the standard this is only possible if you
replace the line above by
const int i=10;
>> system("PAUSE");
>> return 0;
>>}
>>
>>My classmates say that this is a violation of ANSI standard.
They're right.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
Institute of Technology, RWTH Aachen
D 52056 Aachen, Germany
|