About 3,430,000 results
Open links in new tab
  1. How to get column of a multidimensional array in C/C++?

    Mar 7, 2013 · For static declared arrays you can access them like continuous 1D array, p = matrix[0] will give you the 1st column of 1st row. Then the 1D array can be accessed like p[i], …

  2. Relationship Between Pointer and Array in C - GeeksforGeeks

    Dec 3, 2024 · In a three-dimensional array, we use three subscripts to access elements, where the first represents the depth, the second represents the row, and the third represents the …

  3. How to access two dimensional array using pointers in C

    Dec 3, 2017 · To access nth element of array using pointer we use *(array_ptr + n) (where array_ptr points to 0th element of array, n is the nth element to access and nth element starts …

  4. How do you access an element in a two-dimensional array?

    For example, if you have a two-dimensional array named 'matrix', you can access the element in the second row and third column using the syntax 'matrix [1] [2]'. Remember, because indices …

  5. 2D array and pointer in C - how to access elements?

    Jun 24, 2012 · Generally, if p is pointer name,i row number and j column number, (*(p+i)+j) would give a memory address of a element in 2D array. i is row no. and j is col no., *(*(p+i)+j) would …

  6. 11 How do you access an element at row 2 column 3 of a 2-D array

    Jan 17, 2025 · Therefore, to access an element at a specific row and column, you use the row index and column index, both starting from 0. In C, 2D arrays are stored in row-major order. …

  7. How do you access elements in a 2D array? - Sarthaks eConnect

    Nov 15, 2023 · To access elements in a 2D array, you need to use the indices for both the row and column. The syntax for accessing an element in a 2D array is as follows: …

  8. How to access the elements of a 2D array? - Stack Overflow

    c = [a[2][i] * b[2][i] for i in range(len(a[2]))] Which will work for any number of rows. Edit: The first number is the column, the second number is the row, with your current layout.

  9. Pointer to an Array | Array Pointer - GeeksforGeeks

    Apr 30, 2025 · To define a pointer to a 2D array, both the number of rows and columns of the array must be specified in the pointer declaration. Let's take a look at an example: {{7, 8}, {9, …

  10. Selecting specific rows and columns from NumPy array

    Apr 8, 2014 · >>> row_idx = np.array([0, 1, 3]) >>> col_idx = np.array([0, 2]) >>> a[row_idx[:, None], col_idx] array([[ 0, 2], [ 4, 6], [12, 14]])

Refresh