/ Vijos /

记录详情

Compile Error

foo.c: In function 'addToHash':
foo.c:66:1: error: conversion to non-scalar type requested
   66 | p = (nodeH)malloc(sizeof(nodeH));
      | ^
foo.c:67:2: error: invalid type argument of '->' (have 'nodeH' {aka 'struct _nodeH'})
   67 | p->key = key;
      |  ^~
foo.c:68:2: error: invalid type argument of '->' (have 'nodeH' {aka 'struct _nodeH'})
   68 | p->next = hash[key % MAX_SIZE];
      |  ^~
foo.c:69:24: error: incompatible types when assigning to type 'nodeH *' {aka 'struct _nodeH *'} from type 'nodeH' {aka 'struct _nodeH'}
   69 | hash[key % MAX_SIZE] = p;
      |                        ^
foo.c: In function 'isInHash':
foo.c:72:11: error: invalid initializer
   72 | nodeH p = hash[key % MAX_SIZE];
      |           ^~~~
foo.c:73:9: error: invalid operands to binary != (have 'nodeH' {aka 'struct _nodeH'} and 'void *')
   73 | while(p != NULL){
      |         ^~
foo.c:74:5: error: invalid type argument of '->' (have 'nodeH' {aka 'struct _nodeH'})
   74 | if(p->key == key)
      |     ^~
foo.c:76:6: error: invalid type argument of '->' (have 'nodeH' {aka 'struct _nodeH'})
   76 | p = p->next;
      |      ^~
foo.c: In function 'addToQueue':
foo.c:85:1: error: conversion to non-scalar type requested
   85 | tail->next = (nodeQ)malloc(sizeof(nodeQ));
      | ^~~~
foo.c: In function 'main':
foo.c:38:1: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   38 | scanf("%s", line);
      | ^~~~~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1252 @.@斗地主
语言
C
递交时间
2021-12-18 17:02:32
评测时间
2021-12-18 17:02:32
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes