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

multi dimensional array initialization

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



Joined: 28 Feb 2009
Posts: 5
Location: Taunton Ma

View user's profile Send private message Visit poster's website

multi dimensional array initialization
PostPosted: Wed Feb 24, 2010 2:48 pm     Reply with quote

Hello, has anyone used constant multidimensional arrays?
compiler v 4.099
Pic 18f26k20
Code:

const int gtable [][]= {
                       {0x05,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff},     
             {0x01,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff},
                  {0x04,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff},
                       {0x02,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff}
             };

error 86 looking for = ?

Thank You
_________________
Micro-guy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 2:51 pm     Reply with quote

Give it the number of rows and columns. Then it will compile:
Code:

const int gtable [4][17]= {
 
RoGuE_StreaK



Joined: 02 Feb 2010
Posts: 73

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 6:41 pm     Reply with quote

I don't know if it's relevant or even correct, but I was having issues with a similar thing recently, and the method of declaration that worked for me was without the separating brackets and commas; ie:
Code:
const int gtable [4][17]= {
     0x05,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff
     0x01,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff
     0x04,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff
     0x02,0x37,0x51,0x65,0x77,0x87,0x95,0xa2,0xae,0xba,0xc5,0xd0,0xda,0xe4,0xed,0xf7,0xff
     };

Don't know why this was, or whether it just happened to coincide with another issue, but when I did it this way it worked. I've got some sound waveforms stored this way with thousands of samples, and they are now working fine.
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