problem with sleep command

Hi all,
I have a following code,(linux)

#include<stdio.h>
#include<unistd.h>

int main()
{
printf("start");
sleep(3);
printf("stop");
return 0;
}

i am getting output as

first delay
startstop

not understanding why is it so rather than printing "start" and delay then "stop"

Possibly because the output stream is buffered. Try putting

fflush(stdout);

after the first printf

or turn off the buffering mode for STDOUT before itself

using setvbuf

It is related to the output stream being buffered...fully buffered if writing to a file and line buffered if writing to a terminal. As printf() writes to a terminal the stdout stream is line buffered so all that is needed is adding a newline character to the end of the output strings.

printf("start\n");
sleep(3);
printf("stop\n");

its workin, thank u

thanx , adding "\n" and fflush(stdout ) , both are working