ICCAVR arrays of structures

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
struct DataPack
{
 char add;               
 char cmd;              
 int data;                   
 int CRC;                   
};
struct DataPack Slave[3];	
struct DataPack *ptrS;
Slave[]={'3','G',0x77,0x00},
        {'2','A',0xde,0x00},
        {'1','X',0xaa,0x00};

The above snippet doesn't work, I get multiple error messages , most of which are: unrecognized declaration.
I also tried:

struct DataPack Slave[]= {.......},
                         {.......}

as in the above sample.

This seems to be the method I got out of C&R but I get the errors.
Does ICCAVR support structure arrays?

Thanks.

I'll believe corporations
are people when Texas executes one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i know in codevission you need to do:
{ {.......},
{.......} };

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I will test and then post, looks like that might be the problem.

UPDATE: Cleared it right up! Thanks, made my day.

I'll believe corporations
are people when Texas executes one.