프로그램을 실행 시키면 오류가 뜨는데 원인을 모르겠습니다.
곰돌곰돌
질문 제목 : 프로그램을 실행 시키면 오류가 뜨는데 원인을 모르겠습니다.프로그램을 실행 시키면 저쪽이 오류가 뜨는데 뜨는 이유를 모르겠습니다.질문 내용 :
#include stdio.h
#include conio.h
#define false 0
#define true 1
#define start 0
#define size 8
#define null 0
struct node {
int vertex;
struct node *link;
};
struct node *graph[size];
int visited[size];
{
int i;
for (i = 0; i =7; i++)
visited[i] = false;
clrscr();
init_list();
dfs(start);
}int list()
{
struct node *new_node;
int i;
for(i = 0; i size; i++)
graph[i] = null;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[0];
graph[0] = new_node;
new_node-vertex = 2;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[0];
graph[0] = new node;
new_node-vertex = 1;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[1];
graph[1] = new_node;
new_node-vertex = 4;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[1];
graph[1] = new node;
new_node-vertex = 3;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[1];
graph[1] = new node;
new_node-vertex = 0;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[2];
graph[2] = new node;
new_node-vertex = 6;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[2];
graph[2] = new node;
new_node-vertex = 5;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[2];
graph[2] = new node;
new_node-vertex = 0;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[3];
graph[3] = new node;
new_node-vertex = 7;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[3];
graph[3] = new node;
new_node-vertex = 1;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[4];
graph[4] = new node;
new_node-vertex = 7;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[4];
graph[4] = new node;
new_node-vertex = 1;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[5];
graph[5] = new node;
new_node-vertex = 7;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[5];
graph[5] = new node;
new_node-vertex = 2;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[6];
graph[6] = new node;
new_node-vertex = 7;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[6];
graph[6] = new node;
new_node-vertex = 2;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[7];
graph[7] = new node;
new_node-vertex = 5;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[7];
graph[7] = new node;
new_node-vertex = 4;
new_node = (struct node*)malloc(sizeof(new_node));
new_node-link = graph[7];
graph[7] = new node;
new_node-vertex = 3;
}
int dfs(int v)
{
int w;
visited[v] = true;
printf(visited vertex -- %5d\n, v);
do {
w = graph[v] - vertex;
graph[v] = graph[v] - link;
if(!visited[w]) dfs(w);
} while(graph[v] != null);
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2695355 | c언어 for함수 | 미쿡 | 2025-05-19 |
2695327 | 안녕하세요 제가 이번에 좀 큰 프로그램을.. | 악당 | 2025-05-19 |
2695295 | mutex동기화의 thread기반 채팅 서버소스 질문입니다 | 그루터기 | 2025-05-19 |
2695270 | 질문이요..swap 관한겁니다..ㅠㅠ (3) | 콩알녀 | 2025-05-19 |
2695244 | 노땅초보궁금한게 하나 있는데요..반복문(while문)초보자질문 (6) | 큰꽃늘 | 2025-05-18 |
2695166 | do while 문 어떤것이잘못된건지 모르겠어요 (2) | 아이폰 | 2025-05-18 |
2695122 | 구조체에 대해 물어보고 싶은게 있습니다 ^^^.. (7) | 수련 | 2025-05-17 |
2695091 | txt 파일 입출력 후 2차 배열에 저장하기입니다. (3) | 헛장사 | 2025-05-17 |
2695063 | 수도요금 프로그램좀 짜주세요. | 시내 | 2025-05-17 |
2695033 | 답변좀요ㅠㅠ (1) | 비사벌 | 2025-05-16 |
2695010 | C++의 STL은 왜 굳이 템플릿화 시켜서 라이브러리를 만드나요? (초보수준의 질문..) (2) | 엘보어 | 2025-05-16 |
2694958 | 로직이 변한다는 것에 대해서 궁금합니다. | 튼동 | 2025-05-16 |
2694929 | 열혈강의 25-2 두번째 문제 질문 | 지우개 | 2025-05-15 |
2694900 | dequeue 에서 리턴값 프린트 방법알려주세요 오늘 12시까지 대화방에 있습니다 도와주세요 | 미투리 | 2025-05-15 |
2694854 | 절대값을 구할때 (2) | 그녀는귀여웠다 | 2025-05-15 |
2694827 | 이제 어떻게 공부해야할지 모르겠네요 | 새얀 | 2025-05-14 |
2694778 | 순열 계산요. | 맛조이 | 2025-05-14 |
2694754 | ShowWindow 함수를 이용하려 하는데 질문있습니다. (2) | 파도 | 2025-05-14 |
2694731 | 리눅스 커널의 시작점 질문 | 미르 | 2025-05-13 |
2694702 | 이거 뭐가문제인가요 코드수정좀 (3) | 맑은 | 2025-05-13 |