Is it possible to print out (in C) a line of text to the console on a Linux OS containing a variable so that when the variable changes, it changes the printed line instead of printing a new line? For example, if I have the following C code:
void main()
{
int i;
for(i=1;i<=10;i++){
printf("%d\n",i);
sleep(5);
}
}
As is, that would print ten lines. But I want to print one line that updates itself to show the value of i
when it changes.