Thread: array of array

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    array of array

    hello, im a student and im new at programming ( c ), i want learn c for using microprocessor programming, i dont find the answer of this problem, if you know, please help me. i want to create an array of array similar this;
    for example i have got three constant array
    Code:
    unsigned char a_0[]={0x54,0x25,0x11,0xff,0x21};
    unsigned char a_1[]={0x51,0x45,0x55,0x85};
    unsigned char a_2[]={0x24,0x47};
    in program i want to use those costants similar this;
    send(a[0]);

    or i=2;

    send(a[i]);

    how can i do this, all my constants have got different size

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Code:
    unsigned char *arrs[ ] = {
      a_0,
      a_1,
      a_2,
    };
    
    send( arrs[i] );
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    2
    thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. Replies: 6
    Last Post: 11-09-2006, 03:28 AM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM