Re: 16x16Matrix




GrErlenkamp@xxxxxxx wrote:
> Hello there,
>
> i got a list of 16 "two-character" (AU,AG,UC...) elements, and now i
> want to create a 16x16-Matrix with the elements of this list for the
> columns and rows.
> So i need to know: How can i create such a list, how can i access each
> element and use this to create the matrix?
> Thank you for your help
>
> German

The way I understand your problem is that you want a 16x16 matrix where
rows and columns are addressed by AU, AG, ... thingies, and there's 16
of them. You did not specify what is to be held in the matrix, I'll
assume int, but you can pick any other type (including the ones you
define yourself).

enum my_enum (AU = 0, AG, UC /* you fill in the rest */);

int my_matrix[16][16];

It is now possible to address the elements like this:

int x = my_matrix[AU][UC];

Hope this helps. If not, then other replies in the thread might.

Cheers

Vladimir

.



Relevant Pages

  • Re: Online programming challeges?
    ... Hi all, thanks for replies. ... Vladimir, your link does'nt look like abosolute link...couldn't reach ... Prev by Date: ...
    (comp.lang.c)
  • Re: A small question about printf
    ... Thanks for all your replies. ... Is it possible that we can move the cursor to the above line? ... int main ... Prev by Date: ...
    (comp.lang.c)
  • Re: How to determine the way data is stored in memory?
    ... Vladimir S. Oka wrote: ... >> memory and the memory address increases in the left to right ... If on your system char is narrower than an int, ...
    (comp.lang.c)
  • [ncurses] cat xxx |more
    ... int main ... int ch, prev, row, col; ... Works something like a linux cat. ... But this program is limited by *term window size. ...
    (comp.unix.programmer)
  • Re: Main loop helper functions
    ... Vladimir S. Oka wrote: ... > This might as well be void enter_main_loopas it never returns. ... >> int quit_application ... anywhere and it will terminate the program without waiting for some ...
    (comp.lang.c)