They seem to be storing files on a decentralized network. So what is the difference between the two regarding the data structure and the algorithms they use? And also what is the difference between them in terms of use?
If I store the file in IPFS or Filecoin, will it stay there forever or may it get lost?
IPFS supports storage and content addressing. Filecoin is just a way to encourage people to store IPFS content.
So itβs not very easy to tell the difference, because they are not comparable. Filecoin works only on top of IPFS.