There are plenty of foods cotton candy flavor is used for, for example ice cream and grapes.
There are two main flavors that are responsible for Cotton Candies taste that is Ethyl maltol and Strawberry Furanone
Ethyl Maltol is a member of the pyronones and deriative functinal group it has a molecular weight of 140.14 g/mol. This molecule does not occur in nature so it can only be produced by taking a maltol and adding a hydrogen creating a bend in the arm before the CH3 group
Strawberry Furanone has a molecular weight of 128.126 g/mol it belongs to the ketone, hydroxyl, and ether functional groups. It does occur naturally in strawberries however it is more efficient to produce the molecule synthetically in a factory