C语言请问,为什么这个程序里要用static

C语言请教,为什么这个程序里要用static
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define BUF 1024
void append (FILE *source,FILE *dest);

int main (int argc,char *argv[])
{
FILE *fa,*fs;

if (argc != 3)
{
fprintf (stderr,"Usage:%s sourcefile tagetfile.\n",argv[0]);
exit (EXIT_FAILURE);
}
if ((fa = fopen (argv[2],"w")) == NULL)
{
fprintf (stderr,"Can't open %s\n",argv[2]);
exit (EXIT_FAILURE);
}
if (setvbuf (fa,NULL,_IOFBF,BUF) != 0)
{
fprintf (stderr,"Can't create buffer\n");
exit (EXIT_FAILURE);
}
if ((fs = fopen (argv[1],"r")) == NULL)
{
fprintf (stderr,"Can't open %s\n",argv[1]);
exit (EXIT_FAILURE);
}
if (setvbuf (fs,NULL,_IOFBF,BUF) != 0)
{
fprintf (stderr,"Can't create buffer\n");
exit (EXIT_FAILURE);
}
append (fs,fa);
if (ferror (fs) != 0)
fprintf (stderr,"Error in reading file %s.\n",argv[1]);
if (ferror (fa) != 0)
fprintf (stderr,"Error in writing file %s.\n",argv[2]);
fclose (fs);
fclose (fa);
printf ("File %s appended.\n",argv[1]);
printf ("Done");
return 0;
}

void append (FILE *source,FILE *dest)
{
size_t bytes;
static char temp[BUF];   (!!!这里为什么要用static,去掉了程序不能运行!!!!)
int i,i1;

while ((bytes = fread (temp,sizeof(char),BUF,source)) > 0)
{
i1 = strlen (temp);
for (i = 0;temp[i] != EOF && i < i1;i++)
if (islower (temp[i]))
temp[i] = toupper (temp[i]);
fwrite (temp,sizeof(char),bytes,dest);
}
}


------解决方案--------------------
fread不是获得以'\0'结尾的字串,用strlen会越界操作,读入多少直接参考bytes值即可...
//i1 = strlen (temp);
for (i = 0; i < bytes; i++)
...