c - The Output screen freezes after taking the first input and the graphics VDU is not displayed -


my code compiles without warnings , errors when run it, output screen freezes after accepting first input , stops responding abruptly after can't apparently spot bug(s) in code.

enter image description here

//conway's game of life #include<stdio.h> #include<stdlib.h> #include<graphics.h> #include<conio.h>  void setup() {     int x,y,gd=detect,gm,i=0,j,n,a[181][181];     unsigned long turns;      printf("enter number of pixels = ");     scanf("%d",&n);     printf("enter number of turns = ");     scanf("%lu",&turns);     srand(time(0));     initgraph(&gd,&gm,"c://turboc3//bgi");     setbkcolor(11);      for(i=0;i<181;i++)     {         for(j=0;j<181;j++)             a[i][j]=0;     }     for(i=1;i<=n;i++)     {         x=rand()%181;         y=rand()%181;         a[y][x]=1;         putpixel(x,y,4);     } }  void main() {     clrscr();     setup();     getch();     closegraph(); } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -