Technology Sharing

C language pointers and arrays - the relationship between pointers and two-dimensional arrays

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Table of contents

Looking at two-dimensional arrays from a different perspective

Row pointer to a two-dimensional array

Accessing 2D array elements by row pointer

Looking at two-dimensional arrays from another angle

Accessing 2D array elements by column pointer

Two-dimensional array as function parameter

Row pointer to a two-dimensional array as a function parameter

Pointer to column of 2D array as function parameterEdit

Use const to protect the data you pass to the function

summary


A different perspectiveLook at the two-dimensional array

Pointer to a two-dimensional arrayOKpointer

according toRow pointerAccessing two-dimensional array elements

Change another angleLook at the two-dimensional array

according toColumn pointerAccessing two-dimensional array elements

Two-dimensional array as function parameter

Pointer to a two-dimensional arrayOKPointers as function parameters

Pointer to a two-dimensional arrayListPointers as function parameters

useconstProtecting the data you pass to a function

summary