mabd
Joined: 17 Jan 2005 Posts: 8
|
Dynamic bidimensional array with malloc |
Posted: Tue Feb 03, 2009 10:43 am |
|
|
I need a dynamic bidimensional array and I use this code:
Quote: |
typedef char* charp;
charp *buffer;
void main() {
buffer=(charp *)malloc(4);
buffer[0]=(char *)malloc(170);
buffer[1]=(char *)malloc(190);
buffer[2]=(char *)malloc(190);
buffer[3]=(char *)malloc(220);
buffer[0][1]='x';
} |
The compiler returns this error in line buffer[0][1]='x';
Quote: | Error 64: Too many subscripts |
Compiler help about this error: More subscripts have been given to an array than the array was defined with.
In TurboC this code works ok.
Has the CCS compiler problems with pointers, malloc etc?
Thanks |
|