I built a program that is cyclic called. Each time value T changes, and I'd like to compare value T and T from previous cycle, and do it for every cycle.

```
int T = externalsrc; //some external source
int prevT; //cannot do it because in the first cycle it will have no value when used in comparison
int prevT = 0; //cannot do it, because in every cycle prevT will be zero for my comparison
int comparison = prevT - T;
prevT = T;

```

How can I do it properly then? I tried also this, but still T is not declared here:

```
int T;
int prevT;
if (prevT != T)
  prevT = 0;
else
  prevT = externalsrc;
int comparison = prevT - T;
prevT = T;

```