test.c:51:4:错误:分配给类型‘时类型不兼容;型号为‘的黑色;无效*’;
谢谢test.c:51:4:错误:分配给类型‘时类型不兼容;型号为‘的黑色;无效*’;,c,types,struct,void-pointers,C,Types,Struct,Void Pointers,谢谢 typedef struct abc{ int a; char b; }abc; typedef abc bkl[1]; . . . blk b; b=shmat(shmid, NULL, 0); //This error that (Void *) to blk //But anyway blk is pointer,it isn
typedef struct abc{
int a;
char b;
}abc;
typedef abc bkl[1];
.
.
.
blk b;
b=shmat(shmid, NULL, 0); //This error that (Void *) to blk
//But anyway blk is pointer,it isnt ?
blk *b;
b=shmat(shmid, NULL, 0); //This is correct, why? b pointor to pointer
同:
blk b;
b
不是您正在使用的指针
abc b[1];
不正确,因为无法将指针分配给数组。这是错误的,就像下面的错误一样
b = shmat(shmid, NULL, 0);
同:
blk b;
b
不是您正在使用的指针
abc b[1];
不正确,因为无法将指针分配给数组。这是错误的,就像下面的错误一样
b = shmat(shmid, NULL, 0);
不要键入定义数组类型。你只会遇到这种问题。我甚至不会键入指向任何东西的指针。在变量声明中写下所有的
*
,这样会容易得多。不要键入定义数组类型。你只会遇到这种问题。我甚至不会键入指向任何东西的指针。在变量声明中写下所有的*
,这样会容易得多。