내일 까지인데 오류가 많아요...
여우By
질문 제목 : 오류가 많아요...ㅠㅠ오류가 너무 많이뜨고요 ㅠ ?에 어떤 코드를 써야하나요?질문 내용 :
#includestdio.h
#includestdlib.h
#includestring.h
typedef struct listnode{
char data[10];
struct listnode* link;
}listnode;
typedef struct{
listnode* head;
}
linkedlist_h* createlinkedlist_h(void);
void freelinkedlist_h(linkedlist_h*);
void addlastnode(linkedlist_h*, cher*);
void reverse(linkedlist_h*);
void deletelastnode(linkedlist_h*);
void printlist(linkedlist_h*);
linkedlist_h* createlinkedlist_h(void){
linkedlist_h* l;
l = (linkedlist_h*) malloc(sizeof(linkedlist_h));
l - head = null;
return l;
}
void addlastnode(linkedlist_h* l, char* x){
listnode* newnode;
listnode* p;
newnode = (listnode*) malloc(sizeof(listnode));
strcpy(newnode-data, x);
newnod-link = null;
if(l-head == null){
l-head = newnode;
return;
}
p = l-head;
while (p-link != null) {
p = p-link;
}
p -link = newnode;
}
void reverse(linkedlist_h * l){
listnode* p;
listnode* q;
listnode* r;
p = l-head;
q = null;
r = null;
while (p!= null){
r = q;
q = p;
p = p-link;
q-link = r;
}
l-head = q;
}
void deletelastnode(linkedlist_h * l){
listnode* previous;
listnode* current;
if (l-head == null) return;
if (l-head-link == null){
free(l-head);
l-head = null;
return;
}
else{
previous = l-head;
current = l-head-link;
while(current -link != null){
previous = current;
current = current-link;
}
free(current);
previous-link = null;
}
}
void freeplinkedlist_h(linkedlist_h* l){
listnode* p;
while(l-head != null){
p = l-head;
l-head = l-head-link;
free(p);
p=null;
}
}
void printlist(linkedlist_h* l){
listnode* p;
printf(l = ();
p= l-head;
while(p != null){
print(%s, p-data);
p = p-link;
if(p != null){
printf(, );
}
}
printf() \n);
}
int main(){
linkedlist_h* l;
l = createlinkedlist_h();
printf( (1) 공백 리스트 생성하기! \n);
printlist(l); getchar();
printf((2) 리스트에 3개의 노드 추가! \n);
addlastnode(l, 10);
addlastnode(l, 20);
addlastnode(l, 30);
printf((3) 리스트 마지막에 노드 한개 추가! \n);
addlastnode(l, 40);
printlist(l); getchar();
printf((4) 첫번째 노드 삭제! \n);
?(여기 무얼 집어넣어야 하나요)
printlist(l); getchar();
getchar();
return ();
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2690517 | cygwin에서요.. (1) | 엘보어 | 2025-04-05 |
2690486 | 문자열과 문자형이요 ~ | 다스리 | 2025-04-05 |
2690344 | 일본어 주석 깨짐 문제 (3) | 연하얀 | 2025-04-04 |
2690314 | 암호문 만들기 -비제네르- | 이퓨리한나 | 2025-04-03 |
2690292 | 왕초보자의 질문!!!!!! 도와주세요 (1) | 하랑 | 2025-04-03 |
2690269 | 정올 문제 인데.. 흠 | 반월 | 2025-04-03 |
2690237 | sizeof에서 short형을 썻는데 왜 4byte가 나올까요? (1) | 바나나 | 2025-04-03 |
2690183 | 문자열과 포인트 비교 (2) | 미즈 | 2025-04-02 |
2690154 | a -48 ? | 희미한눈물 | 2025-04-02 |
2690094 | 테트리스 질문요. | 지후 | 2025-04-01 |
2690066 | 문자열비교!! (1) | 매디 | 2025-04-01 |
2689888 | 좀도와주세요;; ㅠㅠ | 사람 | 2025-03-30 |
2689856 | 메뉴 그리는 거 질문 | 나라빛 | 2025-03-30 |
2689831 | c언어 프로그램 추천 | 하연 | 2025-03-30 |
2689801 | c언어 time.h에서 작동이 중지되었습니다. | 하람 | 2025-03-30 |
2689772 | 2차원 배열의 배열명에 대해서.. | 옆집꼬마야 | 2025-03-29 |
2689740 | 게임 TCP소켓 질문 (2) | 불꾼 | 2025-03-29 |
2689711 | 반복문 모래시계 | 한뎃집 | 2025-03-29 |
2689685 | 경우의 수에 따른 결과 처리 질문드립니다. (2) | 다흰 | 2025-03-29 |
2689655 | .exe에 아이콘 넣는 법좀 알려주세요 | 연하얀 | 2025-03-28 |