목록Logs/학습 log (43)
Taking baby-developer steps

오늘 목표 디버거(lldb) 사용법 익히기 [->printf()문으로 메모리 주소 찍다가 지침] gnlTest 테스터 Mandatory Part통과 SIGSEGV 잡기 KO 뜨는 케이스 잡기 get_next_line.c 메모리 누수 잡기 오늘 한일 get_next_line.c 메모리 누수 잡기 -> 메모리 누수는 다 잡았는데 할당한 메모리를 중복으로 free하는 구간이 있다. (pointer being freed was not allocated) ->LLDB 사용법 익혀서 메모리 누수 확인하려고 했는데, 결국 LLDB도 메모리 누수가 일어난 메모리 주소정도 알려주는거 같아서, 테스터에 나온 주소 및 printf()문으로 찍은 버퍼들 주소랑 비교해가면서 메모리 누수를 잡았다. 디버거(lldb) 사용법 익히..
#include #include typedef struct { int data; struct Node *prev; struct Node *next; } Node; Node *head, *tail; void insert(int data){ Node *node = (Node*)(malloc(sizeof(Node))); node->data = data; Node *cur; cur = head->next; while(cur->data next; } Node* front = cur->prev; front->next = node; node->prev = front; cur->prev = node; node->next = cur; } void removeFront(){ Node *front = head->next; ..
#include #define INF 10000 int arr[INF]; int count = 0; void addBack(int data){ arr[count] = data; count++; } void addFirst(int data){ for(int i = count; i>=1; i--){ arr[i] = arr[i-1]; } arr[0] = data; count++; } void removeAt(int index){ for(int i = index; i=index; i++){ arr[i]=arr[i-1]; } arr[index] = data; count++; } void show(){ for(int i=0; i