delay() issue

Hi, im trying to write a program in C not c++ to print an array of chars one at a time with a one second delay between each char this is my loop
1
2
3
4
for(k=0;k<N;++){
printf("%c",arr[i]);
delay(1);
}


but it waits for some period of time then just prints it all at once. What am i doing wrong? any help on this would be appreciated. Thanks
Last edited on
The delay is in .001 second increments. Try delay(1000) for a 1 second delay.
You have to flush the stream. Call fflush(stdout); to make sure that the text is printed right away.
Topic archived. No new replies allowed.