There is no difference as far as I can see. The code is identical except you changed the name of your variable.
What might be throwing you off is a scoping issue.
A variable is only "seen" by the program within its current scope. Typically the scope is determined by the surrounding {curly braces}
For example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
int main()
{
Vector vec; // since vec is defined here, its scope is limited to inside the main function
//...
} // <- scope ends, 'vec' no longer exists
void Print( Vector v )
{
// 'v' exists in this scope. But main's 'vec' no longer exists
}
void SomeOtherFunction( Vector vec )
{
// this function has its own 'vec', but it is completely different from the 'vec' declared
// in main. Remember main's 'vec' is out of scope and so it no longer exists.
}
When you pass a variable as a parameter to a function, it basically does an assignment. This allows you to give variables to areas of code that are normally outside their scope.
void Print( Vector v )
{
// Print has its own Vector 'v'
}
int main()
{
Vector vec; // main's vec
//...
Print( vec ); // we pass 'vec' to Print.
// this basically does an assignment.. something like:
// Print_v = main_vec;
// This is done before the code inside the Print function is run. So when you use
// 'v' inside the Print function, it contains the same data as main's 'vec'
// And say for example you have a 2nd vector here:
Vector vec2; // a second vector
//...
Print( vec2 ); // this time we're giving Print 'vec2' as a parameter. So now:
// Print_v = main_vec2;
// Now 'v' in Print will equal 'vec2' in main.
}