you could use fish flakes but dont use them for 2 long. get him some "hikari boi betta gold" an some freeze dried meal worms. He'll love you for ever if you do. trust me
Technically yes, you could use generic goldfish flakes or whatever, but your betta would be nowhere near as happy and healthy as one with a proper diet. He or she would have a weakened immune system and would eventually die from malnutrition.
HBH betta bites, Hikari Betta Bio Gold, and Pro's Choice Betta Pellets are all good staple foods.