windows - Execution of infinite loop in c exe vs c# exe -


i created c program has infinite loop.it runs fine.i created c# program has infinite loop.while form ran,latter program process stopped responding.why both behaves differently? below codes

#include<stdio.h>  int main() {     int i;     for(i=0;i>=10;i++){         printf("%d",i);         }         return 0; } 

c# program:

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms;  namespace windowsformsapplication1 {     public partial class form1 : form     {         public form1()         {             initializecomponent();         }      private void button1_click(object sender, eventargs e)     {         int i=10;         while (i > 1)         {             //do nothing         }     }      private void form1_load(object sender, eventargs e)     {      } } 

}

my question how infinite loops work in these 2 programs?

your c# program in form. windows expects form able process events (e.g. telling close) can't because it's in infinite loop.

if infinite loop in own thread, or wrote c# console application instead of form-based one, think behave more c.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -