i compiled the following code on  
"Red Hat Linux Enterprise AS Realease 4
 Kernel 2.6.9-5 Elsmp"
and the code was compiled successfully and was running.


//I dont know how this code is working.

#include<iostream>
using namespace std;

int main()
{
    int size;
    int arr[size];

    cout<<"Enter size of array: ";
    cin>>size;


    cout<<"Enter values: \n";
    for(int i=0; i< size; i++)
        cin>>arr[i];

    cout<<"Outputting values: \n";
    for(int i=0; i< size; i++)
        cout<<arr[i]<<endl;

    return 0;
}

how the size is being determined by the compiler, when it is not constant? Also
the .c version of above code is compiling and running.

regards,
Amit Singh


-- 
           Summary: Violating standards
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amitondemand at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35125

Reply via email to