DDD에 따르면 나는 strcpy에서 seg fault를 얻고있다. 그러나 내가 잘못하고있는 것을 (아직도 C에서 아주 새로운) 이해할 수는 없다. 어떤 도움이라도 미리 감사드립니다.strcpy Seg 결함
int compare_people(PERSON* first, PERSON* second)
{
char firstName[32];
char secondName[32];
strcpy(firstName, first->name);
strcpy(secondName, second->name);
int returnVal = strcmp(firstName, secondName);
return returnVal;
}
, 그것은 잘못된 메모리에 기록합니다. – mukunda
이름은 평균 5-10 자입니다. – Sammdahamm
'first' 또는'second'가'NULL'이라고 생각합니다. 디버거를 사용하십시오. –