0

Is this a good way to create dynamic variables in C

Is there a better to this -> https://sololearn.com/compiler-playground/cbY9NFZ3h4V1/?ref=app

13th Jan 2024, 1:46 PM
Finama Lflos
Finama Lflos - avatar
1 Réponse
+ 1
it is interesting. but why? it feels like too much work to make the language do something it is it is not designed for. Better leave void* for special cases. One potential problem with this approach is that your data is stored with essentially no type information and could potentially cause an error if it was cast into a wrong datatype if it was part of a larger code. So from a type safety perspective, it is the opposite of what you want to achieve.
13th Jan 2024, 9:32 PM
Bob_Li
Bob_Li - avatar