a program of matrix multiplication using pointers in C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gchidam
    New Member
    • Sep 2009
    • 1

    a program of matrix multiplication using pointers in C++

    please help me out in matrix multiplication using pointers in C++ and give me brief description about usage of pointers
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by gchidam
    please help me out in matrix multiplication using pointers in C++ and give me brief description about usage of pointers
    You don't need pointers to multiply two matrixes; pointers to something are the address in memory of that something.

    kind regards,

    Jos

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Pointers aren't that hard. You already know how to use them.
      For example, let's say your house is located at 123 Fox Street. Now suppose you want to identify the kitchen in the house. In C/C++ that looks like:

      Code:
      house.kitchen
      Or using the address of your house rather than trhe house itself:

      Code:
      123 Fox Street ->kitchen
      Of course you need variables for the house and one for the address:

      Code:
      struct House
      {
          struct kitchen
          {
      
          };
      };
      
      House house;
      House* ptr;
      and before you can use the pointer you need to put the address of the house in it:

      Code:
      ptr = &house;
      and off you go.

      By changing the address in ptr you can reuse the using ptr for different houses.

      Lastly, if you know the address of the house, then you can refer to the house directly by de-referencing the pointer:

      Code:
      (*ptr).kitchen                /*same as house.kitchen */
      and that's about it.

      Comment

      Working...