[英]test.c:51:4: error: incompatible types when assigning to type ‘blk from type ‘void *’
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
Thanks. 谢谢。
blk b;
is the same as: 是相同的:
abc b[1];
b
is not a pointer in the sense that you are using it. b
在您使用它的意义上不是指针。
b = shmat(shmid, NULL, 0);
is incorrect because you can't assign a pointer to an array. 是不正确的,因为您不能将指针分配给数组。 That is wrong exactly the way the following is wrong.
这完全是错误的,就像以下错误一样。
int arr[3];
arr = malloc(sizeof(int)*10);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.