love_electronic
Member level 5
- Joined
- Nov 16, 2010
- Messages
- 93
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,964
Hi guys
I want to assign structure value in an array. Is it possible?
example what i want to do is below
Here A is the structure, after assigning values to it, i copy these values in array tab[0].
I want to ask can i do something like that
Hope i explained it properly.
I want to assign structure value in an array. Is it possible?
example what i want to do is below
Code:
struct paramerters{
unsigned char position1:4;
unsigned char position2:4;
unsigned char position3:4;
unsigned char position4:4;
}A;
unsigned char tab[] = {0x00,0x00};
void main()
{
while(1)
{
A.position1 = 1;
A.position2 = 2;
A.position3 = 4;
A.position4 = 8;
tab[0] = A.position1 | A.position2 | A.position3 | A.position4;
}
}
Here A is the structure, after assigning values to it, i copy these values in array tab[0].
I want to ask can i do something like that
to assign the structure A values in array instead oftab[0] = A
?tab[0] = A.position1 | A.position2 | A.position3 | A.position4;
Hope i explained it properly.