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

Compiler errors...brain fart!

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



Joined: 15 Jul 2005
Posts: 59

View user's profile Send private message

Compiler errors...brain fart!
PostPosted: Wed Sep 28, 2005 3:28 pm     Reply with quote

Hi all,

I have the following C code that compiles in "normal" C

Code:

char *useCaseData[][3] =
{
        {"kam", "was", "here"},
        {"brian", "was", "here"},
        {"sammy", "was", "here"},
        {NULL, NULL, NULL}
};


How would I do the above (if possible) using CCS?
I'm using version(s) PCH 2.234

The data will be const data...
I keep getting compile errors...

Any thoughts?

~Kam (^8*
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 28, 2005 3:47 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=23609&highlight=pointers
kam



Joined: 15 Jul 2005
Posts: 59

View user's profile Send private message

hmmm....not exactly what I need...
PostPosted: Wed Sep 28, 2005 4:01 pm     Reply with quote

Hi,

The problem I have is that the elements of the array are not all the same size.

Code:

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


DOES compile, but the issue is that my elements are not all the same size!
Now...I could adjust the array to something line [12][20] (20 being the max length of the string), but does this NOT waste space? Does the compiler allocate 12*20 or does it "look" at the elements and only use what it needs? (ie. the [20] is the LARGEST...)

Thoughts?

~Kam (^8*
Mark



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

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

PostPosted: Wed Sep 28, 2005 4:23 pm     Reply with quote

In your terms it wastes the space. But, it does just what you told it to do.
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