About 962,000 results
Open links in new tab
  1. Program to find sum of elements in a given 2D array

    Mar 29, 2023 · We can also use pointers to find the sum of elements in a 2D array. We can use a pointer to point to the first element of the array and iterate through each element in the array …

  2. Pointer arithmetic with 2D arrays in C - Stack Overflow

    Nov 16, 2015 · You can statically or dynamically declared an array array[row][col] = {{r0c0, r0c1, r0c2, ...}, {r1c0, r1c1, r1c2, ...} ... }; which will create a single block of memory, with the values …

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

    Dec 3, 2017 · Suppose I have a pointer array_ptr pointing at base address of one dimensional array. To access nth element of array using pointer we use *(array_ptr + n) (where array_ptr …

  4. C Program to Access Two-Dimensional Array Using Pointers

    This guide will demonstrate how to access elements of a two-dimensional array using pointers. 2. Program Overview. 1. Declare a two-dimensional array. 2. Use pointers to traverse this array. …

  5. C Program: Sum of all elements in an array - w3resource

    Mar 19, 2025 · Write a C program to sum an array of integers dynamically allocated and accessed via pointers. Write a C program to find the sum of even-indexed and odd-indexed elements …

  6. C - Pointers and Two Dimensional Array - dyclassroom

    In this tutorial we will learn to work with two dimensional arrays using pointers in C programming language. In the previous tutorial Pointers and One Dimensional Array we learned to work with …

  7. Sum of array using pointer arithmetic - GeeksforGeeks

    Sep 21, 2022 · Given an array, write a program to find the sum of array using pointers arithmetic. In this program we make use of * operator . The * (asterisk) operator denotes the value of …

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

    Jun 24, 2012 · Using pointer arithmetic is treating 2d array like 1D array. Initialize pointer *Ptr to first element (int *Ptr = *data) and then add an no. (Ptr + n) to access the columns.

  9. How to use pointers with 2D arrays in C? - codedamn

    Mar 10, 2024 · To pass a 2D array to a function, you can use pointers. Since arrays decay into pointers when passed to functions, you can leverage this feature for 2D arrays as well. …

  10. Pointers and Multidimensional Arrays in C/C++ - Medium

    Aug 21, 2024 · In a 2D array, each element can be accessed using two indices: i for rows and j for columns, i.e., ptr[i][j]. However, with pointers, you can use pointer arithmetic to achieve the …