*you can just change the code as followed:* * * *int *b = ( int * ) malloc(sizoeof(int) * b[2]);* *or * *int *b = new int[b[2]]; * On Tue, Jan 4, 2011 at 5:58 AM, Aniket <aniket...@gmail.com> wrote:
> #include<iostream> > using namespace std; > const int a[]={1,2,3,4,5}; > int b[a[2]]; > int main(){return 0;} > > If the code is like above it is giving error in line 4; > > But if it is something like below it gives no error after compilation: > > #include<iostream> > using namespace std; > const int a=3; > int b[a]; > int main(){return 0;} > > Anybody please expalin. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- ** * Best Regards, Devil Wang * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.