The array number of elements is unknown
The file input is: 2 3 4 5 8 0
The array will have: 2 3 4 5 8
int read(FILE *in,int a[])
{
int i = 0;
int temp;
while(fscanf(in, "%d", &temp) != EOF)
{
a[i++] = temp;
}
return i;
}
Now I've got troubles now printing it out to a file this code shows nothing:
void printingg(FILE *out,int a[],int n)
{
int i;
for(i=0;i<n;i++)
{
fprintf(out,"%d ",a[i]);
}
}
Aucun commentaire:
Enregistrer un commentaire