Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 分配给类型‘时不兼容的类型;类型‘中的类型定义;uint8&x2019;_C_Struct_Typedef - Fatal编程技术网

C 分配给类型‘时不兼容的类型;类型‘中的类型定义;uint8&x2019;

C 分配给类型‘时不兼容的类型;类型‘中的类型定义;uint8&x2019;,c,struct,typedef,C,Struct,Typedef,我遇到了typedefs的一个问题 typedef char cool_array_t[ARRAY_SIZE]; cool_array_t* out; // do stuff with out cool_array_t test = *out; 我得到的错误如下: 从类型分配给类型“cool\u array\t”时,类型不兼容 “char*” 我尝试使用casting out来冷却\u array\t,但出现以下错误: 错误:强制转换指定数组类型 您不能分配给数组。您需要使用memcpy或包

我遇到了typedefs的一个问题

typedef char cool_array_t[ARRAY_SIZE];

cool_array_t* out;
// do stuff with out
cool_array_t test = *out;
我得到的错误如下:

从类型分配给类型“cool\u array\t”时,类型不兼容 “char*”

我尝试使用casting out来冷却\u array\t,但出现以下错误:

错误:强制转换指定数组类型


您不能分配给数组。您需要使用
memcpy
或包装
struct

struct cool_array_t {
    char data[ARRAY_SIZE];
};

struct cool_array_t* out;
// do stuff with out
struct cool_array_t test = *out;
memcpy(&test,out,sizeof test)