아래 굵게 칠한 부분으로 왜 안들어올까요..?ㅠㅠㅠ 조건이 맞는데
안들어오네요
디버그하면 word 가 "모멘트"
a가 "모멘트"로 나오는데 왜 조건문안으로 안들어오죠..?ㅠㅠ
12시까지 제출인데 힌트라도 주세요 ㅠㅠㅠ
----------------------
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define S_SIZE 50
typedef struct NODE{
char title[S_SIZE];
int year;
struct NODE *link;
}NODE;
int main(void)
{
FILE *fp = NULL, *fp2 = NULL;
NODE *list = NULL;
NODE *prev,
*p,*q, *next;
char buffer[S_SIZE];
char name[S_SIZE];
char
word[S_SIZE];
char temp[S_SIZE];
char buffer2[S_SIZE];
int
year;
char *a;
fp2 = fopen("output.txt", "r");
printf("책이름을 입력하시오 :
");
scanf("%s", word);
while (!feof(fp2))
{
q
= (NODE *)malloc(sizeof(NODE));
fscanf_s(fp2, "%s", name,
S_SIZE);
fscanf_s(fp2, "%d", &year, S_SIZE);
strcpy_s(q->title, S_SIZE, name);
q->year =
year;
if (list == NULL){
list = q;
}
else{
prev->link = q;
}
q->link = NULL;
prev = q;
a = q->title;
if (a == word){
printf("책의 제목 : %s \n",
q->title);
printf("출판연도 : %d \n\n",
q->year);
exit(1);
}
}
q = list;
while (q != NULL){
next =
q->link;
free(q);
q = next;
}
}
if(memcmp(q->title, word, strlen(word)+1)){
아 메모리비교라는게 따로 있군요!! 코로모님 감사합니다 ㅠㅠㅠㅠㅠㅠㅠㅠ