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

Question regarding int16 arrays??

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



Joined: 08 Sep 2003
Posts: 492
Location: India

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

Question regarding int16 arrays??
PostPosted: Sat Dec 23, 2006 1:32 am     Reply with quote

Hi,

MCU: 16F877A
Compiler: PCM 3.228

I have the following declaration

int16 nVariable[18],p[8],nReturn;

Is this OK

nVariable[p[0]]=nReturn;

Or do I have to do this

nVariable[make8(p[0],0]=nReturn;

I find that when I use the first method, the value stored in nVariable[0] array is lost, when I load nVariable[1] with some data.

The program compiles OK, the RAM is 78-91 % and does not generate any errors, is it possible that the program goes haywire in the mcu ?

thanks
arunb
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat Dec 23, 2006 3:42 pm     Reply with quote

Both methods should work, but the second method with the make8() looks clumsy, if the array p only is to contain 8 bit data than declare it int8 instead of int16.

I couldn't reproduce your error. As a regular poster on this forum you should know a small but complete program demonstrating your problem will give you better and faster responses, until then I'm not going to spend more time into this
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