전체 글

Hello World
    반응형
Back End/C

[C] RecursiveReverse 구현하기

문제Write a C function recursiveReverse()that recursively reverses the given linked list by changing its next pointer and its head pointer.https://github.com/yeooonee/Jungle-C-Data-Structure/blob/master/Data-Structures/Linked_List/Q7_A_LL.c Jungle-C-Data-Structure/Data-Structures/Linked_List/Q7_A_LL.c at master · yeooonee/Jungle-C-Data-StructureContribute to yeooonee/Jungle-C-Data-Structure devel..

CS/자료구조·알고리즘

[C] moveMaxToFront 구현하기

문제Write a C function moveMaxToFront() that traverses a linked list of integers at most once, then moves the node with the largest stored value to the front of the list가장 큰 값 찾아서 앞으로 옮기기https://github.com/yeooonee/Jungle-C-Data-Structure/blob/master/Data-Structures/Linked_List/Q6_A_LL.c Jungle-C-Data-Structure/Data-Structures/Linked_List/Q6_A_LL.c at master · yeooonee/Jungle-C-Data-StructureContr..

Back End/C

C 에서의 char[], String 배열 타입

C 에서 char 은 문자 타입이 아니라 크기가 1바이트인 정수 타입이다. 다른 언어와 달리 C 는 문자라는 개념을 언어 차원에서 거의 갖고 있지 않다. 그냥 숫자를 담아두고, 출력할 때 ASCII 표를 보고 글자 모양으로 그려준다. 배열을 주는 쪽char str[256];balanced(str); 배열을 받는 쪽배열 이름을 표현식에서 쓰면, "첫 원소의 주소" 로 변환된다. 예외는 sizeof(str), &str. 이 두 경우만 배열 그 자체로 남는다. int balanced(char *expression){ // &str[0]이 전달된다. expression[1]; *(expression + 1); char *p = expression + 1; while (*expressio..

Back End/C

[C] expression must be a modifiable lvalue 에러 해결하기

아래에서 뭐가 문제인지 찾아보면, 왜 발생했는지 알 수 있다. while(expression != '\0'){ ch = expression[i]; if (ch = "(" || ch = "{" || ch = "["){ ... } i++; } 그렇다 조건식에 비교 연산자가 아닌 대입 연산자를 사용했다. while(expression != '\0'){ ch = expression[i]; if (ch == "(" || ch == "{" || ch == "["){ ... } i++; } 끝

Back End/C

C 언어 - GCC 정리

gcc란gcc는 .c 파일을 CPU가 실행할 수 있는 파일로 번역하는 프로그램이다. gcc -Wall -g hello.c -o hello # 컴파일./hello # 실행 gcc 는 전처리 → 컴파일 → 어셈블 → 링크를 한 번에 해준다. 에러 종류를 알면 원인을 더 빨리 찾을 수 있다. 에러 종류 error: 'x' undeclared단계 : 컴파일, 문법, 선언 문제 undefined referece to 'foo' 단계 : 링크, 함수 선언만 하고 정의를 안 썼거나, 파일/라이브러리를 빠뜨렸다. gcc 옵션-o test결과물 이름을 test 로 설정한다. -o 없이 컴파일하면 결과물 이름이 a.out 이 된다. -g디버깅 정보 넣기 (gdb 쓸거면 필수) -Wall -Wextra경고 최..

    반응형
Lar
개발지식 저장소