수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

실행에러 잡아주세열!ㅜㅜ

맑은누리

2023.04.01


질문 제목 : 실행에러 문제가 있네요질문 내용 : #include stdio.h
#include stdlib.h
#include string.h
int menu(void);
void author_search(struct book *std, int size);
void title_search(struct book *std, int size);
void display(struct book *std, int size);
void save(struct book *std, int size);
void enter(struct book *std, int size);

struct book {
char name[20]; //이름
char title[15]; //
char pub[20]; //
unsigned int date;
unsigned int edition;
};

int main() {
struct book *std=null;
int sel;
int size;
while(1){
sel = menu();
switch(sel){
case 1:

printf(몇 개의 레코드를 입력하시겠습니까? : );
scanf(%d, &size);
fflush(stdin);
enter(std,size);
break;
case 2: author_search(std, size);
break;
case 3: title_search(std, size);
break;
case 4: save(std, size);
break;
case 5: return 0;

}
}

return 0;
}
void enter(struct book *std, int size)
{int i;
std = malloc(sizeof(struct book) * size);
if( std == null ){
printf(동적 메모리 할당 실패\n);
return;
}

for(i=0; isize; i++){
printf(저자이름 : );
gets(std[i].name);
//if(std[i].name==\r) break;
printf(제목: );
gets(std[i].title);
printf(출판사: );
gets(std[i].pub);
printf(출판일: );
scanf(%d,&std[i].date);
printf(판수: );
scanf(%d,&std[i].edition);
fflush(stdin);
}

}
void author_search(struct book *std, int size)
{
int i;
char temp[20];
printf(검색할 저자명을 적어주세요 : );
scanf(%s,temp);
for(i=0; isize; i++) {
if(!strcmp(std[i].name, temp))
{
display(std,size);

}
}
}
void title_search(struct book *std, int size)
{
int i;
char temp[20];
printf(검색할 책제목을 적어주세요 : );
gets(temp);

for(i=0; isize; i++) {
if(!strcmp(std[i].title,temp)==0)
{
display(std,size);

}
}
}

void display(struct book *std, int size)
{
int i;
for(i=0; isize; i++){

printf(저 자 명 = %s\n, std[i].name);
printf(제 목 = %s\n, std[i].title);
printf(출 판 사 = %s\n, std[i].pub);
printf(출 판 일 = %d\n, std[i].date);
printf(판 수 = %d\n, std[i].edition);
}
}
void save(struct book *std, int size)
{
file *fp;
int i;
fp=fopen(c:\\save.txt, w);
if(fp == null)
{
printf(파일 열기 실패);
return;
}
for(i=0; isize;i++) {
fprintf(fp,%s %3s %3s %3d %3d\n, std[i].name,std[i].title,std[i].pub,std[i].date,std[i].edition);
}

fclose(fp);
}
int menu()
{
int a;
printf(1. enter\n);
printf(2. search by author\n);
printf(3. search by title\n);
printf(4. save catalog\n);
printf(5. quit\n);

scanf(%d, &a);
&n/preturn a;
}
1번을 눌러 자료를 실행하면
2번 부분에서 실행 에러가 납니다.
0x004015e5 에 있는 명령이 0x000003c의 메모리를 참조 했습니다. read될수 없습니다 하고 나오네요

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

번호 제 목 글쓴이 날짜
2704497 int double char 같은것좀 좀만 더 가르쳐 주세요 (6) 로지 2025-08-10
2704473 구조체 배열 초기화 질문 꽃은별 2025-08-10
2704445 배열과 조건문에 관한질문 (3) 찬솔큰 2025-08-10
2704417 이진 트리 깊이 값 구하는것 질문입니다. 푸른잎 2025-08-10
2704391 자료 유형에 관련된 문제입니다. (2) 늘솜 2025-08-09
2704365 c언어 문제안되서물어봅니다 (3) 맑은가람 2025-08-09
2704338 다항식의 뺄셈에 대해 질문드립니다... (1) 여자 2025-08-09
2704311 센서를 이용한 라인 주행인데 명령어좀 알려주세요 ㅠ_ㅠ (3) 초록이 2025-08-09
2704284 배열for문;; (3) 은솜 2025-08-08
2704255 readline(int fd, char *buf, int nbytes)함수를 구현하는법좀..ㅠㅠ 파라나 2025-08-08
2704196 간단한 c언어좀 만들어주세요 (2) 슬S2아 2025-08-08
2704118 성적에서 등수 구하기 (4) 딥레드 2025-08-07
2704062 알고리즘 알려주세요 나리 2025-08-06
2704035 답은 나오는데 과정에서 `` 약간 이상합니다.ㅎㅎ 답만나와버려요 핫블랙 2025-08-06
2703979 문자열 EEPROM 작성 방법 문의드립니다. 그녀는귀여웠다 2025-08-06
2703954 키보드를 입력하면 캐릭터를 움직이기 질문 (7) 좋아해 2025-08-05
2703924 계속 에러가... (4) 눈꽃 2025-08-05
2703897 배열의 최댓값과 최솟값 차이 구하기 (1) 하늬 2025-08-05
2703869 C언어 질문입니다 급해용!!! ㅠㅠ (2) 덕이 2025-08-05
2703814 C로 프로그램을 만들때 도스창 말고 다르게 만드는방법이 있을까요? (2) 소심한여자 2025-08-04
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com