Advertisement
iamos

LinkedList.c (Skeleton)

May 28th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct node{
  5.     int data;
  6.     struct node* next;
  7. }node;
  8.  
  9. node* createNode(int input){
  10.     /*
  11.         노드포인터 변수 temp 에 Node를 위한 공간을 할당받아서 주소를 저장함 ( malloc 이용 )
  12.         temp의 data에는 받은 argument를 넣어주고
  13.         temp의 next은 NULL
  14.         그리고 할당받은 공간의 주소를 return 해줌
  15.     */
  16.     node* temp;
  17. }
  18.  
  19. void showLinkedList(node* head){
  20.     /*
  21.         LinkedList의 head를 받아서 head부터 끝까지 Data들을 출력해줌
  22.         Hint.
  23.             head부터 node안의 data를 출력한다.
  24.             언제까지 출력 해야할까?
  25.             While 이용하면 편함
  26.     */
  27. }
  28. int main(int argc, char const *argv[]){
  29.     /*
  30.         1) createNode() 작성
  31.         2) ShowLinkedList() 작성
  32.         3) Main() 작성:
  33.             createNode() 함수를 이용해서 node를 만들고
  34.             head
  35.                 5 -> 4 -> 3 -> 2 -> 1
  36.             모양으로 저장 LinkedList를 만들어라
  37.         Test)
  38.             showLinkedlist(head);
  39.             ----------------------
  40.             output
  41.             5 4 3 2 1
  42.     */
  43.     node* head;
  44.  
  45.     // Code HERE
  46.  
  47.     showlinkedList(head);
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement