How to assign into global array of pointers object from loop function?

My sketch was working till I have initialised all object in global section of sketch.
But is it possible somehow to declare array of pointers like this:

OneWire *oneWiresArray[sensorPortsCount];// later will be added &oneWire,&oneWire2,&oneWire3
DallasTemperature *sensorsPortsArray[sensorPortsCount]; //&sensors,&sensors2,&sensors3

and to initialise values not in global section, but in loop, or another function?

for (int i = 0; i < sensorPortsCount; i++) {
OneWire l_oneWire(oneWirePortArray*);*
oneWiresArray = &l_oneWire;
* DallasTemperature l_sensors(&l_oneWire);
sensorsPortsArray = &l_sensors;
_ }*
It seems that wwhen I create this in setup,it working in setup function
and it is possible to call it in loop, but it seems, that object are not well configured, it seems like some data are not initialised completely_

Yes. I_oneWire only exists in ONE iteration of the loop. Once you go to the next iteration, the old object is destroyed, and a new object w/o be created.

So, you must dynamically allocate the objects if you know what you are doing.
Or create an array with fixed number of objects.

Italic code as used by geniuses everywhere...

This compiles though I have no OW devices with which to check it the way the loop is setup it does appear pin 13 (built-in LED on Mega2560) is doing something.

#include <OneWire.h>

const byte sensorPortsCount = 5;
const byte groneWirePortArray[] = 
{
    2, 3, 4, 5, 13
    
};//groneWirePortArray

OneWire
    *grOneWires[sensorPortsCount];

void setup( void )
{
    for (int i = 0; i < sensorPortsCount; i++) 
        grOneWires[i] = new OneWire( groneWirePortArray[i] );

}//setup

void loop( void )
{
    grOneWires[4]->reset();
    
}//loop