0
에 따라 달라집니다조건부 점프 또는 이동 내가 내 코드의이 비트에 문제가 초기화되지 않은 값
unsigned long me_hash(MEntry *me, unsigned long size){
unsigned long hashval=0;
int i=0;
for(i=0; me->surname[i];i++) hashval +=me->surname[i] + 28 * hashval;;
for(i=0; me->surname[i];i++){
if(me->postcode[i]) {
hashval += me->postcode[i] + 28 * hashval;
}
}
hashval += me->house_number;
return (hashval%size);
}
그렇게하지 내가 Valgrind의이
==4480== Conditional jump or move depends on uninitialised value(s)
==4480== at 0x8048EB7: me_hash (mentry.c:66)
==4480== by 0x8048B3E: ml_lookup (mlist.c:91)
==4480== by 0x80488D2: main (finddupl.c:43)
==4480==
입니다 실행할 때 내가받을 메시지 이 문제를 해결하는 방법을 알아야합니다. 당신이 나를 도울 수?
는
'me-> surname [i];'또는'me-> postcode [i]'가 초기화되지 않았습니까? 사용하기 전에 인쇄하여보십시오. – gsamaras