What is causing my esp8266 to reboot ?

Here is code I have written:

   #include <stdio.h>
    #include <ESP8266WebServer.h>

    #define MAX_WIFI_INIT_RETRY 50
    #define WIFI_RETRY_DELAY 500

    const char* wifi_ssid = "ssid";
    const char* wifi_passwd = "password";
    
    ESP8266WebServer http_rest_server(80);
    
    const int numParams = 20;
    String params [numParams];
    
    String toString(String my_array[], int size)
    {
      String string;
      for (int i = 0; i < size; i++) {
        string = string + ", " + my_array[i];
      }
      return string;
    }
    
    int init_wifi() {
      int retries = 0;
      Serial.println("Connecting to WiFi AP..........");
      WiFi.mode(WIFI_STA);
      WiFi.begin(wifi_ssid, wifi_passwd);
      // check the status of WiFi connection to be WL_CONNECTED
      while ((WiFi.status() != WL_CONNECTED) && (retries < MAX_WIFI_INIT_RETRY)) {
        retries++;
        delay(WIFI_RETRY_DELAY);
        Serial.print("#");
      }
      return WiFi.status(); // return the WiFi connection status
    }
    
    void readParams(String (& params) [numParams])
    {
      int mn = WiFi.scanNetworks();
      for (int i = 0; i < mn; i++)
      {
        //    Serial.println(WiFi.SSID(i).c_str()); // prints name of all hotspots in serial monitor.
        params [i] = WiFi.SSID(i).c_str();
      }
    }
    
    void listHotspots() {
      String results = toString(params, sizeof(params));
      Serial.println(results);
      http_rest_server.send(200, "text/plain", results);
    }
    
    void config_rest_server_routing() {
      http_rest_server.on("/", HTTP_GET, []() {
        http_rest_server.send(200, "text/html",
                              "Welcome to the ESP8266 REST Web Server");
      });
      http_rest_server.on("/hotspots", HTTP_GET, listHotspots);
    }
    
    void setup(void) {
      Serial.begin(115200);
    
      init_led_resource();
    
      WiFi.mode(WIFI_STA);
      WiFi.disconnect();
      readParams (params);
    
      if (init_wifi() == WL_CONNECTED) {
        Serial.print("Connetted to ");
        Serial.print(wifi_ssid);
        Serial.print("--- IP: ");
        Serial.println(WiFi.localIP());
      }
      else {
        Serial.print("Error connecting to: ");
        Serial.println(wifi_ssid);
      }
    
      config_rest_server_routing();
    
      http_rest_server.begin();
      Serial.println("HTTP REST Server Started");
    }
    
    void loop(void) {
      http_rest_server.handleClient();
    }

Inadequate 3.3V can cause ESP8266 modules to reboot.

.

If the ESP doesn't put out a reboot cause message the power is the most likely culprit.
Though within such a small program this is usually not a problem, you should keep in mind that to add to a 'global' String array like this is not such a good plan.

void readParams(String (& params) [numParams])
    {
      int mn = WiFi.scanNetworks();
      for (int i = 0; i < mn; i++)
      {
        //    Serial.println(WiFi.SSID(i).c_str()); // prints name of all hotspots in serial monitor.
        params [i] = WiFi.SSID(i).c_str();
      }
    }