Hi shibin , Great ! regardsPraseed Pai --- On Thu, 11/4/10, shibin k reeny <[email protected]> wrote:
From: shibin k reeny <[email protected]> Subject: Re: [ILUG-Cochin.org] Indefinite loop in C To: "This List discusses GNU/Linux & GNU, GPL Software" <[email protected]> Date: Thursday, November 4, 2010, 12:12 AM 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] -----Inline Attachment Follows----- _______________________________________________ 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]
