Pointer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freqzz
    New Member
    • Feb 2007
    • 11

    Pointer

    I got a problem using pointer.

    I got two table in two different file.

    First one:

    x y z

    7 6 5
    1 3 4
    2 1 4

    the other one:

    node1 node2 node3

    1 2 3
    2 3 1
    3 1 2

    My problem is, how do i point table two to take the value of table one.

    let say table two says node1 = 1, node2 = 2 and node3 = 3
    so the out put will be:

    (7,6,5)(1,3,4)( 2,1,4)

    it means that the number in table two will refer to line in table one.

    Thanx.
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    read the first file

    x y z

    7 6 5
    1 3 4
    2 1 4

    into a 2D array
    Code:
          int table1[100][3];
    read each row from the file into a row in the array, e.g. after reading the first line
    table[0][0]=7, tavle1[0][1]=6, table1[0][2]=5
    etc

    when you read a node from file 2 it will give the row number in the table

    Comment

    • freqzz
      New Member
      • Feb 2007
      • 11

      #3
      Thanks, but currently i have two structure, i cant manage two link both data together.

      Code:
      struct Point
      {
      	float x, y, z;
      };
      
      struct Tin
      {
      
      	float node1, node2, node3;
      
      };

      Comment

      Working...