Message-ID: <3941DA42.1DEE7B3E@cam.org> From: Uriel Weizmann X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: error flaging I can't reason with.. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Forwarded: by - (CAM) Lines: 59 Date: Fri, 09 Jun 2000 23:03:46 -0700 NNTP-Posting-Host: 198.168.100.7 X-Complaints-To: abuse AT videotron DOT net X-Trace: wagner.videotron.net 960605784 198.168.100.7 (Fri, 09 Jun 2000 22:56:24 EDT) NNTP-Posting-Date: Fri, 09 Jun 2000 22:56:24 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com The present is a c++ source program containing two lines commented respectively CASE1 and CASE2. Until this moment I can't find an explanation why CASE1 does not work. I thing that POINTR1 and ARRAY1 are exactly the same type variables with the same data. The puzzle even grows by the fact that if we eliminate the & from the parameter ARRAY in the prototype of FILLARRAY (changing ARRAY from POINTER REFERENCE to the older style POINTER TO INTEGER, CASE1 works fine. Thank you for your help Uri. #include // #include // #include void fillarray (int* &array) { for (int i=0; i < 10; i++) array[i] = (2 * i); } int main() { int array1[10]; int* pointr1= array1; /* at this point array1 and pointr1 are the "same" and should be completely interchageable */ /*******************************************************************/ // fillarray (array1); // CASE 1: compiler flags error/* fillarray (pointr1); // CASE 2: no errors as well as does the job /********************************************************************/ for (int i=0; i < 10; i++) cout << " " << (array1[i])<< endl; return(0); }