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 CCS Technical Support

Arrays of character strings

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



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

Arrays of character strings
PostPosted: Mon Jul 11, 2005 4:42 am     Reply with quote

Hi,

Does CCS compiler support this declaration.

Code:

char *pName[12] = {
    "123", "456", "789", "abc",
    "NAY", "TOY", "TYU", "ERD",
    "LOT", "BAS", "ALL", "TEL"
};


I compile this and it gives me an error "expecting a declaration".
btw, I am using PCH v3.188.

Are there any alternative such that I can utilize this declaration.
Thank u.
valemike
Guest







PostPosted: Mon Jul 11, 2005 5:39 am     Reply with quote

You have a 12 x 4 array (4 because you need the null character at the end):

Code:

char array_Name[12][4] = {
    "123", "456", "789", "abc",
    "NAY", "TOY", "TYU", "ERD",
    "LOT", "BAS", "ALL", "TEL"
};


This compiles.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

Re: Arrays of character strings
PostPosted: Mon Jul 11, 2005 9:55 am     Reply with quote

chingB wrote:
Hi,

Does CCS compiler support this declaration.

Code:

char *pName[12] = {
    "123", "456", "789", "abc",
    "NAY", "TOY", "TYU", "ERD",
    "LOT", "BAS", "ALL", "TEL"
};


I compile this and it gives me an error "expecting a declaration".
btw, I am using PCH v3.188.

Are there any alternative such that I can utilize this declaration.
Thank u.


No, pointers to constants are not allowed.
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