Posted to tcl by hat0 at Fri Nov 30 02:28:49 GMT 2007view raw

  1. struct xy { int x,y; };
  2.  
  3. struct xy make_xy(int x,int y) {
  4. struct xy my;
  5. my.x = x;
  6. my.y = y;
  7. return my;
  8. }
  9.  
  10. void set_xy(struct xy &my,int x,int y) {
  11. my.x = x;
  12. my.y = y;
  13. }
  14.  
  15. struct xy test[3];
  16.  
  17. test[0] = make_xy(1,2);
  18. puts("test is ${test}");
  19.  
  20. set_xy(&test[1], 2, 3);
  21. puts("test is ${test}");
  22.