CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Dynamic bidimensional array with malloc

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mabd



Joined: 17 Jan 2005
Posts: 8

View user's profile Send private message Send e-mail

Dynamic bidimensional array with malloc
PostPosted: Tue Feb 03, 2009 10:43 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group