How to print in C programing with slight delay?

1.46K viewsPrograming

I’m trying to print something like this: Existing…

In the terminal when the program ends, but the way I want it to be delivered to the terminal, after “exiting” each point has to be printed in the same line one after the other with a slight delay. Like it’s too heavy to put on. But I have no idea how to print each of them separately without having to print the whole line at once. I’m sure if this is possible in the first place. I’ve tried using time to add a delay between each printf but it didn’t work.

admin Answered question April 13, 2021

Time Delay in C programing 

May be it will help you to make slight delay in C language

// C function showing how to do time delay
#include <stdio.h>
// To use time library of C
#include <time.h>
void delay(int number_of_seconds)
    // Converting time into milli_seconds
    int milli_seconds = 1000 * number_of_seconds;
    // Storing start time
    clock_t start_time = clock();
    // looping till required time is not achieved
    while (clock() < start_time + milli_seconds)
// Driver code to test above function
int main()
    int i;
    for (i = 0; i < 10; i++) {
        // delay of one second
        printf("%d seconds have passed\n", i + 1);
    return 0;

admin Answered question April 13, 2021