help plz~~~~~~storing a matrix in C

This is a discussion on help plz~~~~~~storing a matrix in C within the C Programming forums, part of the General Programming Boards category; if i have a matrix like A B C D E .... Z A 0.1 0.12 0.5 0.04 ... B ...

  1. #1
    Unregistered
    Guest

    Unhappy help plz~~~~~~storing a matrix in C

    if i have a matrix like

    A B C D E .... Z

    A 0.1 0.12 0.5 0.04 ...

    B 0.33 0.2 0.11 0.14

    C 0.9 0.02 ..............
    .
    .
    .
    Z

    -------------------------------
    where the entries in the maxtrix are the probability converting column to row
    eg probabilty column A -> row C = 0.33

    cos there are 26x26 entries....
    my Q is ...what's an easy way to store these probabilities in C , so i can find the
    corresponding prob say Z -> E ..etc


    thanks for the help

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    Code:
    int  main(void)
    {
          float data[26][26] = {
                                        {0.1, 0.2, 0.3, /* ... */},
                                        {0.4, 0.5, 0.6}
                                         /*   ...   */
                                     };
    
          printf(" AxB: %f\n", data['A' - 65]['B' - 65]);
    
          return (0);
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 04:57 PM
  3. Gauss-Jordan Matrix Inversion in C++
    By Max_Power82 in forum C++ Programming
    Replies: 3
    Last Post: 12-03-2006, 07:31 PM
  4. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM

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