Trying to Add One

I am trying to count count from 1-10 and print out each number. This is the code I am running

int c = 1;
void setup() {
  // put your setup code here, to run once:

 Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
 if ( c<= 10) {
  Serial.println("c is less than 10");
  Serial.println(c); 
  c + 1; 
 }
 else {
  Serial.println("C equals 10");
  Serial.println(c);
 }
}

When I run the code this happens:

ss than 10
1
c is less than 10
1
c is less than 10
1
c is less than 10
1
c is less than 10
1
c is les

I think it happens because the loop resets the if statement every time. Is it possible to make the loop not end so it runs c from 1 to 10?

c + 1;

what is that supposed to do?

 c + 1;

That line is useless. Did you mean to assign the result back to c?

c = c+ 1;

Or the shorthand

c+=1;

Or

c++;

I thought it would add one to c doing c +1;
I tried

c++;

and c = c+1;

But that still returns the same integer over and over again.
I also tried this:

void setup() {
  // put your setup code here, to run once:

 Serial.begin(9600);
}

void loop() {
  int c = 2;
  int b = 5;
  
  // put your main code here, to run repeatedly:
 if ( c<= 10) {
  Serial.println("c is less than 10");
  Serial.println(c); 
  c = c+1; 
  b = c + b;
  Serial.println(b);
 }
 else {
  Serial.println("C equals 10");
  Serial.println(c);
 }
 delay(1500);
}

B ends up being 8, so C has been added one. However, when I run the code it prints out

c is less than 10
2
8
c is less than 10
2
8
c is less than 10
2
8

So I think the loop resets each time. Is it possible to not reset the loop so the value for C is saved and it eventually adds up to 10?

void loop() {
  int c = 2;
  int b = 5;

because c and b are created each time loop() runs and are destroyed each time loop() ends.

google C++ Local Variable

Yes. In the last one you define the variables in loop. So they are local to loop. And each time loop repeats it creates them with the values specified. At the end of loop they go out of scope and are destroyed. Try making them global like you did in the code in the OP. Google "C++ scope" for more info.

Thank you for the help. I got it to work, I didn't realize the loop would reset the integer every time if I put it within that.

To keep them within loop use the static keyword. Using static, the first time through loop they have the values 2 and 5, but are not reinitialized each time through loop, they keep the values assigned inside of loop.

void loop() {
  static int c = 2;
 static int b = 5;

They are called local variables, then. This keeps the declaration and initialization near where the variables are used.