简体   繁体   English

C中的语法错误

[英]syntax error in C

I am trying to build a block where I am getting this error message 我正在尝试建立一个获取此错误消息的块

pprbc_CONTENT_icverification_act.c", line 99.2: 1506-018 (S) Operand of indirection operator must be a pointer expression

Can anyone please explain what this means? 谁能解释一下这是什么意思?

code below: 下面的代码:

   *(WORK_migration_ind_f) =
   *(migration_status_in_MI9_CIRCLE_INFO(WORK_source_circle_f));

Yes, you put a '*' in front of something that isn't a pointer. 是的,您在不是指针的内容前加上“ *”。

You'd be doing yourself and everybody a favor if you posted the line of code involved. 如果您发布涉及的代码行,那么您将对自己和所有人都有利。

Presumably you have code something like this: 大概您有这样的代码:

int x;

*x;    // apply indirection to non-poiner

But it's impossible to say without seeing the actual code that causes the error message. 但是,如果没有看到导致错误消息的实际代码,就不可能说。

The * (indirection) operator dereferences a pointer; * (间接)运算符取消引用指针; that is, it converts a pointer value to an l-value. 也就是说,它将指针值转换为l值。 The operand of the indirection operator must be a pointer to a type. 间接运算符的操作数必须是指向类型的指针。

Either the variable WORK_migration_ind_f or the return type of the function migration_status_in_MI9_CIRCLE_INFO (or both) is not a pointer type. 变量WORK_migration_ind_f或函数migration_status_in_MI9_CIRCLE_INFO的返回类型(或两者)都不是指针类型。 You can dereference only a pointer. 您只能取消引用指针。

If you have code like: 如果您有如下代码:

int *pi;
int i;
int f(void);
int *pf(void);

Then, the following "makes sense": 然后,以下“有意义”:

*pi /* is of type int */
*pf() /* is of type int */

The following doesn't: 以下不是:

*i /* can't dereference a non-pointer */
*f() /* can't dereference a non-pointer */

If you show us the declarations of WORK_migration_ind_f and WORK_migration_ind_f , we can tell you more, but I think you should be able to figure the error out on your own now. 如果您向我们展示WORK_migration_ind_fWORK_migration_ind_f的声明,我们可以告诉您更多信息,但是我认为您现在应该能够自己找出错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM