Casting a void pointer to a 2D String array pointer (C/CPP)

preview_player
Показать описание
Casting a void pointer to a 2D String array pointer (C/CPP)
I hope you found a solution that worked for you :)
Thanks to all those great people for their contributions!


I wish you all a wonderful day! Stay safe :)

arrays void-pointers casting pointers c++
Рекомендации по теме
Комментарии
Автор

Screw that c++ shenanigans and just cast it to a (String***).

Another option would be:
struct container {
String[100][10] array;
};

int callback(void* data) {
container* ptr = (container*) data;
ptr->array[0][0] = "Test" ;
Return 0;
}

Conclusion is if you use a void* or a c-cast you can never guarantee neither the type nor the array size. You leave the c++ type system and lose all guarantees.

redcrafterlppa
join shbcf.ru