c - 我无法在 ‘;’ token 之前解决我的代码预期表达式中的此错误

标签 c syntax-error

嗨,我或多或少是 c 的新手,在学习如何使用结构和 union 时,我收到了这个错误:“';' 标记之前的预期表达式”我一直在寻找错误很长一段时间,但我找不到它。我所要求的只是在以下代码中需要的地方进行更正。

我在 mac os x 上使用 Gnu C 编译器

#include <stdio.h>;
#include <stdlib.h>;

struct lista;
struct elemento;
union member{
  int i;
  struct lista * n;};

struct elemento{
  union member * v;
  struct elemento * n;};

struct lista{
  int len;
  struct elemento * n;};

void append(struct lista* a , union member * e);

int main(void){
  return 0;}

void append(struct lista * a , union member * e){
  struct elemento ** j= ((*a).n)*;                    /* error here */
  int c;
  for(c=0;c<(*a).len;c++){
    j=((**j).n)* ;}                                   /* error here */
  (*a).len++;
  *j=(struct elemento *)malloc(sizeof(struct elemento));
  (**j).v=e;}

它在第 24 行和第 28 行代码中引发了两个错误,请帮助我

最佳答案

struct elemento ** j= ((*a).n)*;   // 24th line

试试这个-

struct elemento ** j= & ((*a).n); // Note the removal of * and adding & symbol before.

由于j是指向指针的指针,所以需要加上&符号。

关于c - 我无法在 ‘;’ token 之前解决我的代码预期表达式中的此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11764153/

相关文章:

c - 在密码学、C 编程方面需要帮助

php - 常量表达式包含无效操作

C- 字符串和循环

c++ - 将 int8 转换为 int7 的最快方法

php - WordPress自定义字段在single.php中的位置

scala - 使用:=时,scalajs中出现“illegal start of simple expression”错误

kendo-ui - 语法错误 : Unexpected token ILLEGAL

excel - 找不到错误: VLOOKUP not returning the value

c - 这容易受到堆栈溢出的影响吗?

c - 我有 24 个单独的位(1 或 0),想要用这些位形成一个大小为 3 的字节数组(形成 3 个字节),并需要一个指针