By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,332 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,332 IT Pros & Developers. It's quick & easy.

Pointer

P: 11
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.
Mar 21 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,510
read the first file

x y z

7 6 5
1 3 4
2 1 4

into a 2D array
Expand|Select|Wrap|Line Numbers
  1.       int table1[100][3];
  2.  
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
Mar 21 '07 #2

P: 11
Thanks, but currently i have two structure, i cant manage two link both data together.

Expand|Select|Wrap|Line Numbers
  1.  
  2. struct Point
  3. {
  4.     float x, y, z;
  5. };
  6.  
  7. struct Tin
  8. {
  9.  
  10.     float node1, node2, node3;
  11.  
  12. };
  13.  
  14.  
Mar 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.