4 ms·
Structs in C vs Structs in C++ vs Structs in C#
- crpatino 13y agoInteresting description of what structs are in C#. However, I found the descriptions in C and C++ very lacking, specially the nonsense about stack vs heap allocation.
- digitalsol 13y agoYou are right, that was a typo. I changed that yesterday. Best Regards
- scott_s 13y agoAlso, the struct in C++ is allocated on the heap. Not correct. Just as in C, in C++, all objects - be they primitive types, instances of structs or classes - are allocated on the stack by default. If you want them allocated on the heap, you must explicitly request it.
- digitalsol 13y agoYou are right, that was a typo. I changed that yesterday.
- adamnemecek 13y ago"Also, the struct in C++ is allocated on the heap." I'm probably misunderstanding what the author wanted to say but this is not correct. Structs are by default allocated on the stack.
- digitalsol 13y agoYou are right, that was a typo. I changed that yesterday. Best Regards