![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
chingB
Joined: 29 Dec 2003 Posts: 81
|
Arrays of character strings |
Posted: Mon Jul 11, 2005 4:42 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
valemike Guest
|
|
Posted: Mon Jul 11, 2005 5:39 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: Arrays of character strings |
Posted: Mon Jul 11, 2005 9:55 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|