Computer Science/알고리즘

포인터를 사용하여 2차원 배열 데이터 접근하기

mj73 2020. 8. 25. 08:56

https://sandbox.cs50.io/87d1e71b-ae34-4473-a25c-6b9fd64aa68e

 

CS50 Sandbox

Temporary programming environments for students and teachers.

sandbox.cs50.io

2차원배열의 행과 열의 크기를 각각 구하는 부분을 아래와 같이 선언하였다.

int row = sizeof(arr) / sizeof(arr[0]); //행

int col = sizeof(arr[0]) / sizeof(arr[0][0]); //열