记录详情

Compile Error

foo.c:6:5: error: unknown type name 'Node'
    6 |     Node* next;
      |     ^~~~
foo.c: In function 'FindMaxNeg':
foo.c:18:14: warning: assignment to 'struct Node *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   18 |         head = head->next;
      |              ^
foo.c: In function 'main':
foo.c:28:5: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   28 |     Node* head1 = NULL;
      |     ^~~~
      |     struct 
foo.c:29:5: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   29 |     Node* head2 = NULL;
      |     ^~~~
      |     struct 
foo.c:30:5: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   30 |     Node* tail1 = NULL;
      |     ^~~~
      |     struct 
foo.c:31:5: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   31 |     Node* tail2= NULL;
      |     ^~~~
      |     struct 
foo.c:35:9: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   35 |         Node* newp = new Node;
      |         ^~~~
      |         struct 
foo.c:35:22: error: 'new' undeclared (first use in this function); did you mean 'newp'?
   35 |         Node* newp = new Node;
      |                      ^~~
      |                      newp
foo.c:35:22: note: each undeclared identifier is reported only once for each function it appears in
foo.c:35:26: error: expected ',' or ';' before 'Node'
   35 |         Node* newp = new Node;
      |                          ^~~~
foo.c:36:13: error: request for member 'data' in something not a structure or union
   36 |         newp->data = k;
      |             ^~
foo.c:37:13: error: request for member 'next' in something not a structure or union
   37 |         newp->next = NULL;
      |             ^~
foo.c:45:18: error: request for member 'next' in something not a structure or union
   45 |             tail1->next = newp;
      |                  ^~
foo.c:52:9: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   52 |         Node* newp = new Node;
      |         ^~~~
      |         struct 
foo.c:52:26: error: expected ',' or ';' before 'Node'
   52 |         Node* newp = new Node;
      |                          ^~~~
foo.c:53:13: error: request for member 'data' in something not a structure or union
   53 |         newp->data = k;
      |             ^~
foo.c:54:13: error: request for member 'next' in something not a structure or union
   54 |         newp->next = NULL;
      |             ^~
foo.c:62:18: error: request for member 'next' in something not a structure or union
   62 |             tail2->next = newp;
      |                  ^~
foo.c:66:30: warning: passing argument 1 of 'FindMaxNeg' from incompatible pointer type [-Wincompatible-pointer-types]
   66 |     int maxNeg1 = FindMaxNeg(head1);
      |                              ^~~~~
      |                              |
      |                              int *
foo.c:9:29: note: expected 'struct Node *' but argument is of type 'int *'
    9 | int FindMaxNeg(struct Node* head)
      |                ~~~~~~~~~~~~~^~~~
foo.c:67:30: warning: passing argument 1 of 'FindMaxNeg' from incompatible pointer type [-Wincompatible-pointer-types]
   67 |     int maxNeg2 = FindMaxNeg(head2);
      |                              ^~~~~
      |                              |
      |                              int *
foo.c:9:29: note: expected 'struct Node *' but argument is of type 'int *'
    9 | int FindMaxNeg(struct Node* head)
      |                ~~~~~~~~~~~~~^~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
A9-3 数组中最大的负数
比赛
2023 程序设计与竞赛(作业8:链表的世界)
语言
C
递交时间
2023-11-25 21:05:52
评测时间
2023-11-25 21:05:52
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes