-1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv){
struct Node *hashtable[1000000];
struct Node *starting=NULL;
if(argc!=2){
return 0;
}
FILE *file = fopen(argv[1], "r");
if(file==NULL){
printf("error\n");
return 0;
}
int j;
for(j=0; j<1000000;j++){
hashtable[j]=NULL;
}
char user;
int value;
int k;
while(fscanf(file,"%c %d\n", &user, &value)==2){
if(value>=0){
k=(value%1000000);
}else{
k=-(value%1000000);
}
if(user=='i'){
if(hashtable[k]!=NULL){
struct Node *temp=hashtable[k];
hashtable[k]=insertNew(temp,value);
} else{
hashtable[k]=insertNew(starting,value);
}
}
有正在使用更多的方法,但我收到以下错误:收到此错误:赋值时将整数指针不进行强制转换
third.c:86:45:警告:赋值时指针从整数没有投的[默认启用] hashtable [k] = insertNew(temp,value); ^ third.c:88:45:warning:赋值使整数指针没有转换[默认启用] hashtable [k] = insertNew(starting,value);
我明白这是什么意思,但我很困惑,为什么我在这里得到这个错误...
如果'insertNew'在同一个编译单元中,由于匹配类型不匹配,您也会得到编译器**错误**。链接器不是那么严谨。 –
@WeatherVane:这不是链接警告。 – alk
@alk我知道。但是在不同编译单元中的函数没有错误 - 只是说。 –