Help with reference and pointers printing

I am trying to find the source of error in my program and wanted to check if it's coming from a part of code.

1
2
3
4
5
6
7
  	const Vector &end1Crd = theNodes[0]->getCrds();
    const Vector &end2Crd = theNodes[1]->getCrds();    
    Vector xp = end2Crd - end1Crd;
    L = xp.Norm();
	cout<<" end1Crd(1) " << end1Crd(1)<<" end1Crd(2) " << xp(2)<<" end1Crd(3) " << end1Crd(3) <<endl;
	cout<<" end2Crd(1) " << end1Crd(1)<<" end2Crd(2) " << xp(2)<<" end2Crd(3) " << end2Crd(3) <<endl;
	cout<<" xp(1) " << xp(1)<<" xp(2) " << xp(2)<<" xp(3) " << xp(3) <<endl;


shouldn't I get xp(1)=end1Crd(1)-end2Crd(2)? However I am getting the following:

end1Crd(1) 0 end1Crd(2) 0.0001 end1Crd(3) -7.44618e-315
end2Crd(1) 0 end2Crd(2) 0.0001 end2Crd(3) -3.78577e-270
xp(1) 0.2238 xp(2) 0.0001 xp(3) -1.45682e+144

Could someone please explain me why?
¿what is Vector?
You are lying in line 5.

Also, consider using a debugger
Topic archived. No new replies allowed.