if (fpin == NULL)
{
printf("Erro ao abrir o ficheiro.");
exit(1);
}
if(fpout == NULL)
{
printf("Erro ao abrir o ficheiro.");
exit(1);
}
//And i dont think fgetc should be the best option but i have very limited Knowledge in c
for(i=0;i<100;i++)
{
word[i]=fgetc(fpin);
}
//Im trying to save one array to another but also changing is index so when it appears in the final file its a little scrambled ...
for(i=0;i<100;i++)
{
trocas[i]=word[i+1];
trocas[i+1]=word[i];
}
The purpose of this program is to read a txt file sending it to an array , then it sends to another but a little scrambled and then it sends to the final file ... name fpout ...
i think the probem is i+1 your loop runs to 99 because you array has elements from 0-99 that is ok. But the last element you read is 99+1=100, but this element does not exist.
the problem is when i execute the file ... The elements of the array "Trocas" should be the ones in array word but a little scrambled ... But its the same ... Not scrambled ... Both arrays are identical but i thought that for would scramble theirs index ...