Thread: C code segmentation faulting -_-
i don't why isn't working. no warnings appear when compiling.
code:#include <stdlib.h> #include <stdio.h> void main() { int shade[10]; //10 different shades averaged every 10 loops int count=0; int shades; int average; int epicint; (int i=0;i>-1;i++) { count++; // ^ because loops make code smarter shade[count]=rand()%40+1; if (count==10) { count=0; shades=0; (int j=1;j<=10;j++) { shades=shades+shade[j]; } average=shades/10; printf("%d\n",average); epicint=average*0.80; } } }
i compiled , ran no issue:
i didn't segfaults. there infinite loop, no segmentation fault.code:$ gcc -std=c99 -wall foo.c $ ./a.out
  		  		  	Forum    	The Ubuntu Forum Community    	Ubuntu Specialised Support    	Development & Programming    	Programming Talk    		  	 C code segmentation faulting -_-     	
 Ubuntu
 
  
Comments
Post a Comment