I have a loop in my test.c who will do several things, e.g.
int main()
{
...do things...
int calculate=0;
while(x <=10000) {
...operation on calculate...;
x++;
//print calculate every 'x' seconds
};
return 0;
}
What I need to do is find a way to output the “calculate” variable every “x” seconds, e.g. every 5 seconds, obviously without using sleep as I need my loop continues. Could someone advise with the approach I could use?