Assign values to a set of array of structures

This is a discussion on Assign values to a set of array of structures within the C Programming forums, part of the General Programming Boards category; I'm trying to build a data structure of known size. Like this Code: struct operation_matrix{ float mtrx[16]; }operation[894]; I know ...

  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, 08:25 PM
  2. Assign an arrays values to another array
    By laczfinador in forum C Programming
    Replies: 3
    Last Post: 05-06-2009, 08:46 AM
  3. Replies: 12
    Last Post: 04-12-2009, 06:49 PM
  4. array of structures
    By tish in forum C Programming
    Replies: 9
    Last Post: 04-05-2009, 04:17 AM
  5. 2 Dimenstional Array vs Array of Structures
    By jrahhali in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2004, 05:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21