A beach is fun for people, but not so much for plants. You are growing in, basically, powdered glass, with almost no nutrients, what water there is is salty. And yet there are many plants growing on the beaches of the Restinga, the coastal strip of the Mata atlantica. One of the commonest is Cereus fernambucensis, the beach thistle.
Cacti are especially adapted to living in hot arid places. It's all about storing what water you can, and minimising loss, so thick succulent stems with no leaves to reduce surface area and evaporation, and a waxy coating. Cacti, like all plants, have to "breathe", but they are adapted to only do so at night, storing CO2 from the atmosphere for use in photosynthesis during the day.
Cereus fernambucensis takes this one step further and even flowers at night. This means it can't be pollinated by the usual suspects, but no problem, it relies on local hawk moths. Both win, the cactus being pollinated and the moths getting a good supply of nectar. Once pollinated, the white flowers form red seeds pods which eventually burst releasing black seeds.
A little less mutually beneficial is an association with the local skinks, Mabuya agilis, which mostly run around in leaf litter catching and eating insects and spiders. Cereus makes a good perch for catching the suns rays and warming their little bodies, but even more so in the afternoon when the sun is low and the air is starting to cool. Heat absorbed by the cacti means they act as radiators, and skinks climb up the stems and absorb the heat directly.
Cereus would be a tempting source of succulent flesh it were not so fearsomely armoured with spines. But it has another enemy to cope with, fire. The restinga is baked dry by the sun, and fanned by winds off the south Atlantic, and fires are not uncommon. Even here Cereus toughs it out, being one of the first plants to regenerate on burnt restinga. The one thing it can't cope with is cold, suffering at temperatures below 10 C, which restricts the southern part of it's range.
A beach is not a healthy place to live, but as Robinson Crusoe found, if you are tough and adapt, a living can be made.
I would like to acknowledge the help of Helio Pacheco Filho in the preparation of this article.