Where to use "static volatile bool"? Why in the piece of code below we use "static volatile bool"?

static volatile bool wifi_connected = false;


taken from here: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino
static means that the global will only be accessible inside the current translation unit.

volatile means that while(!wifi_connected){/*...*/} cannot be optimized to if(!wifi_connected)while(true){/*...*/}

These things are orthogonal. So you would use static volatile when you need both properties.