First time using Structs in Arduino since school I am assuming that the structs would behave like objects and when I call them directly it does I would expect this code to print
1 1
2 1
1 2
2 2
1 3
2 3
1 4
2 4
But I get
1 1
2 1
1 1
2 2
1 1
2 3
1 1
2 4
Sample of the code that I used
// Example program
#include <iostream>
#include <string>  
struct Testtype{
    Testtype(int A) : foo(A){}
    int foo;
    int bar = 0;
   };
Testtype Test1 = Testtype(1);
Testtype Test2 = Testtype(2);
void fun(Testtype Test){
   Test.bar++;
   Test2.bar++;
   std::cout << Test.foo;
   std::cout << " " << Test.bar << "\n";
   std::cout << Test2.foo;
   std::cout << " " << Test2.bar << "\n";
}
void loop(){
   fun(Test1);
}
int main()
{
  int i =0;
  while (i < 4){
    loop();
    i++;
  }
}
