포인터

BugDict/C

[C언어] "Segmentation fault (core dumped)" 해결

문제상황: 다음 코드는 배열을 동적으로 할당한 후, 포인터를 사용하여 배열에 접근하려고 합니다. 하지만 실행시 "segmentation fault" 에러가 발생하며 프로그램이 종료됩니다. #include #include int main() { int *arr; int size; printf("Enter the size of the array: "); scanf("%d", &size); arr = (int *) malloc(size * sizeof(int)); for (int i = 0; i

Bug Detector
'포인터' 태그의 글 목록