i want to know the code in C language
when i will compile the program the character will delay printing in the display.
Please help.

thanks.

what compiler are you using?
check the sleep function from the unistd.h library if your using linux or windows.h for windows

Try something like this:

#include <stdio.h>
#include <windows.h>

const int DELAY_IN_MICROSECONDS = 100;

int main (void)
{
    char symbol = 'a';

    while (1)
    {
        putchar(symbol++);

        if (symbol > 'z')
        {
           symbol = 'a';
           putchar('\n');
        }

        fflush(stdout);
        Sleep(DELAY_IN_MICROSECONDS);
    }

    return 0;
}

More information about Windows' Sleep function here: MSDN

Edited 4 Years Ago by pritaeas: Fixed your link. The editor has trouble with links containing parenthesis.

const int DELAY_IN_MICROSECONDS = 100;
Sleep(DELAY_IN_MICROSECONDS);

Sleep() takes a parameter that represents milliseconds, not microseconds. I just wanted to point that out in case readers don't study the documentation you linked to closely enough, and then find Sleep() doesn't have the granularity they want.

Edited 4 Years Ago by deceptikon

Sleep() takes a parameter that represents milliseconds, not microseconds. I just wanted to point that out in case readers don't study the documentation you linked to closely enough, and then find Sleep() doesn't have the granularity they want.

Woops yeah, meant to type milliseconds. Thanks for the heads up.

This article has been dead for over six months. Start a new discussion instead.