foo.c:1:1: error: unknown type name 'Item'
1 | Item *create(double p[], int e[],int len)
| ^~~~
foo.c: In function 'create':
foo.c:3:5: error: unknown type name 'Item'
3 | Item* head = new Item;
| ^~~~
foo.c:3:18: error: 'new' undeclared (first use in this function)
3 | Item* head = new Item;
| ^~~
foo.c:3:18: note: each undeclared identifier is reported only once for each function it appears in
foo.c:3:22: error: expected ',' or ';' before 'Item'
3 | Item* head = new Item;
| ^~~~
foo.c:4:9: error: request for member 'next' in something not a structure or union
4 | head->next = NULL;
| ^~
foo.c:4:18: error: 'NULL' undeclared (first use in this function)
4 | head->next = NULL;
| ^~~~
foo.c:1:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
+++ |+#include <stddef.h>
1 | Item *create(double p[], int e[],int len)
foo.c:6:5: error: unknown type name 'Item'
6 | Item *tail = head;
| ^~~~
foo.c:11:9: error: unknown type name 'Item'
11 | Item *item = new Item;
| ^~~~
foo.c:11:26: error: expected ',' or ';' before 'Item'
11 | Item *item = new Item;
| ^~~~
foo.c:12:13: error: request for member 'next' in something not a structure or union
12 | tail->next = item;
| ^~
foo.c:14:13: error: request for member 'p' in something not a structure or union
14 | item->p = p[i];
| ^~
foo.c:15:13: error: request for member 'e' in something not a structure or union
15 | item->e = e[i];
| ^~
foo.c:16:13: error: request for member 'next' in something not a structure or union
16 | item->next = NULL;
| ^~
foo.c:17:17: error: request for member 'next' in something not a structure or union
17 | if (head->next == NULL) {
| ^~
foo.c:18:17: error: request for member 'next' in something not a structure or union
18 | head->next = item;
| ^~
foo.c: At top level:
foo.c:26:18: error: unknown type name 'Item'
26 | double calculate(Item* head, double x) {
| ^~~~
foo.c:37:1: error: unknown type name 'Item'
37 | Item* add(Item *head1, Item *head2) {
| ^~~~
foo.c:37:11: error: unknown type name 'Item'
37 | Item* add(Item *head1, Item *head2) {
| ^~~~
foo.c:37:24: error: unknown type name 'Item'
37 | Item* add(Item *head1, Item *head2) {
| ^~~~
foo.c:112:1: error: unknown type name 'Item'
112 | Item* sub(Item *head1, Item *head2) {
| ^~~~
foo.c:112:11: error: unknown type name 'Item'
112 | Item* sub(Item *head1, Item *head2) {
| ^~~~
foo.c:112:24: error: unknown type name 'Item'
112 | Item* sub(Item *head1, Item *head2) {
| ^~~~
[Hydro](https://hydro.ac)提供评测服务