KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My problem is to send a structure between a program in C to a C# program. I made a structure in C#: public struct NetPoint { public float lat; // 4 bytes public float lon; // 4 bytes public int alt; // 4 bytes public long time; // 8 bytes } The total size of the structure must be 20 bytes. When I do a sizeof() in C++ of this structure, System.Diagnostics.Debug.WriteLine( "SizeOf(NetPoint) = " + System.Runtime.InteropServices.Marshal.SizeOf(new NetPoint())); the debug console shows: SizeOf(NetPoint) = 24 But I expected to have 20 bytes. Why do I see a difference?
Tags (comma-separated)
Save Edits
Cancel