bug in clang

Hi,
     I was coding a USACO practice problem mhen I came across this bug which causes a Segmentation fault (I am using Fedora 14 x86_64). Please consider the following code:

#include <stdio.h>

int main ()
{

     FILE *fout = fopen ("test.txt", "w");
     char character[5];
     int i;
     for(i = 0; i < 6; i++)
     {
         character[i] = 'A'; //This statement causes an error
     }

fprintf(fout, "Point 1\n");

     return (0);
}

God bless you,
Andrew Wells

-char character[5];
+char character[6];

Hi,
    I was coding a USACO practice problem mhen I came across this bug
which causes a Segmentation fault (I am using Fedora 14 x86_64). Please
consider the following code:

Hi Andrew,

Your code is correct. "character" only has space for 5 characters and you're accessing the 6th.

-Chris

^incorrect. Doh.

-Chris