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

array declaration

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



Joined: 29 Aug 2013
Posts: 9

View user's profile Send private message

array declaration
PostPosted: Mon Sep 23, 2013 11:43 pm     Reply with quote

Hi

I want to assign values to the variable (6 variable). And then make array with this variable like given below.
Code:

int8 R_vtg = 0x01;
int8  Y_vtg = 0x02;
int8 B_vtg = 0x03;

int16 input_regs[]={ R_vtg,Y_vtg, B_vtg};

I know it is wrong but suggest me some way by which such array is formed.
Ttelmah



Joined: 11 Mar 2010
Posts: 19447

View user's profile Send private message

PostPosted: Tue Sep 24, 2013 2:26 am     Reply with quote

I suggest getting a C textbook....

It is not at all obvious what you are trying to do. There is no such 'type of array' in C. It looks like you are trying to build an int16 array, containing other variables (which happen to be int8). An array is a variable in it's own right, it can't 'contain' other variables.
Possibly you are trying to construct an array of pointers?. If so then the array needs to be an array of pointers (not int16), and needs to be given the address of the variables, not the variables themselves.
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