![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: May 2006
Location: Philippines
Posts: 21
Rep Power: 0
![]() |
multi dimensional array error
i hav a problem bout arrays... why cant i allocate the variable in this array?
thnx for your help #include<iostream> using namespace std; main() { int r=1,c=1,r2,c2; cout<<"Enter the no. of rows you desire for matrix1:"; cin>>r; cout<<"Enter the no. of coloumns you desire for matrix1:"; cin>>c; cout<<"Enter the no. of rows you desire for matrix2:"; cin>>r2; cout<<"Enter the no. of coloumns you desire for matrix2:"; cin>>c2; if(r2>c) cerr<<"invalid row input"; int **matri1[]=new int[r][c];// source of error<----- this is it for(int i=0;i<r;i++) { for(int j=0;j<c;j++) cin>>matri1[i][j]; } for(int k=0;k<r;k++) { for(int j=0;j<c;j++) { cout<<matri1[k][j]; } cout<<endl; } } |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C# corruption!!! | Kilo | C++ | 32 | May 21st, 2006 9:44 PM |
| Masm | rsnd | Assembly | 4 | May 20th, 2006 10:05 PM |
| libraries | matko | C | 1 | Jan 22nd, 2006 3:12 PM |
| HELP please!!! | hamacacolgante | C | 7 | Nov 21st, 2005 6:36 AM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 3:36 AM |