내일 까지인데 오류가 많아요...
여우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 ();
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2694450 | while문질문입니다. (1) | 허리품 | 2025-05-11 |
2694420 | C언어 질문할게요(유니코드,자료형,버퍼,캐스트연산자) | 은새 | 2025-05-11 |
2694370 | 내일까진데 함수호출 제발 도와주세요!!!!!!!!!11 | 들찬 | 2025-05-10 |
2694339 | putchar()의 괄호 안에 int c=10;로 전에 선언된 c를 넣으면 안되는 이유에서 제가 생각한 것이 그 이유가 되는지 확인하고 싶습니다. (3) | 미르 | 2025-05-10 |
2694316 | 이 코드 어디가 잘못되었는지 고수분들 ㅠㅠ (2) | 나빛 | 2025-05-10 |
2694285 | 언어 공부하는 과정 좀 추천해주세요! (1) | 아빠몬 | 2025-05-09 |
2694258 | 카운터.. 질문입니다. (4) | 하늘빛눈망울 | 2025-05-09 |
2694229 | 단순한 질문이요 (8) | 여름 | 2025-05-09 |
2694202 | 용돈을 가지고 할 수 있는 일을 여러가지로 출력하는 방법 좀 알려주세요! (2) | 미나 | 2025-05-09 |
2694145 | 화면깜빡임을 없애고 싶은데요... (1) | 어서와 | 2025-05-08 |
2694069 | unsigned 질문입니다. | 힘차 | 2025-05-07 |
2694012 | 전공 비전공자 개발자 (10) | 말글 | 2025-05-07 |
2693984 | 오버로딩이 무엇인가요? (2) | 헛매질 | 2025-05-07 |
2693956 | PlaySound재생이 안됩니다!(C에 음악넣기) | 지존 | 2025-05-06 |
2693928 | &와 *의 사용에 관한 명확한 이해 | 제나 | 2025-05-06 |
2693903 | 반복문 설명좀요 ㅠㅠ (2) | 란새 | 2025-05-06 |
2693869 | stdio.h 는 왜 쓰는건가요? (1) | 큰꽃들 | 2025-05-06 |
2693842 | 포인터 변수의 주소값끼리 더하는 것에 대해서 질문드립니다. (1) | 진솔 | 2025-05-05 |
2693811 | 소수 출력;;;; | 화이트캣 | 2025-05-05 |
2693788 | 이런 함수는 없나요? (3) | 앤드류 | 2025-05-05 |