Thread: Assign values to a set of array of structures

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    1

    Assign values to a set of array of structures

    I'm trying to build a data structure of known size. Like this
    Code:
    struct operation_matrix{
        float mtrx[16];
    }operation[894];
    I know all values, and I'm planning to use perl to write the assignments for all elements, but the way of doing so for a simple array does not work.
    Code:
    operation[0].mtrx[]{0.5,....last};
    Is there a way of doing it this way?
    I guess there must be a better way of dealing with this, but I'm starting with C ( used to program in fortran).

    Thanks in advance!

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Code:
    float mtrx[894][16]
    springs to mind. . . or
    Code:
    struct operation_matrix{
            float mtrx[16];
    } operation[894] = {
           { .mtrx = {0.5, .......  last} },
            ........
    }
    may work also, if I have all my ducks in a row.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. Assign an arrays values to another array
    By laczfinador in forum C Programming
    Replies: 3
    Last Post: 05-06-2009, 07:46 AM
  3. Replies: 12
    Last Post: 04-12-2009, 05:49 PM
  4. array of structures
    By tish in forum C Programming
    Replies: 9
    Last Post: 04-05-2009, 03:17 AM
  5. 2 Dimenstional Array vs Array of Structures
    By jrahhali in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2004, 04:51 AM