Cast a struct of ints to an array of ints

后端 未结 4 560
日久生厌
日久生厌 2021-01-20 01:52

I am using a library that has a function that takes an array of structs. That struct and function has the following layout:

struct TwoInt32s
{
  int32_t a;
         


        
4条回答
  •  悲&欢浪女
    2021-01-20 02:26

    It's safest to not cast, but convert -- i.e., create a new array and fill it with the values found in the struct, then kill the struct.

提交回复
热议问题