Skip to main content

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:

code:
$ gcc -std=c99 -wall foo.c  $ ./a.out
i didn't segfaults. there infinite loop, no segmentation fault.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk C code segmentation faulting -_-


Ubuntu

Comments

Popular posts from this blog

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support