try this code..
#include<stdio.h>
main()
{

    printf("Hello World");
    fflush(stdout);
    while(1);

}


but i dont know why we have to use fflush(stdout); function or why other
code didnt work.
On Wed, Nov 3, 2010 at 1:28 PM, Antony Padayattil <[email protected]>wrote:

>  I expected the following code to print "Hello World" and then enter an
> indefinite loop. But, contrary to what I expected, it seems that it directly
> enters the loop.
>
>
> Here is the code:
>
> #include<stdio.h>
>
> main()
>
> {
>
>     printf("Hello World");
>
>     while(1)
>
>         ;
>
> }
>
>
> I have also noted that if "Hello\nWorld" is given instead of "Hello World",
> it prints "Hello" and then enters the loop.
>
> Requesting explanation.
> Thanks in advance.
>
>
>
> _______________________________________________
> Indian Libre User Group Cochin Mailing List
> http://www.ilug-cochin.org/mailing-list/
> http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
> #[email protected]
>
_______________________________________________
Indian Libre User Group Cochin Mailing List
http://www.ilug-cochin.org/mailing-list/
http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
#[email protected]

Reply via email to