Retrieve the Addresses of Elements in a Two-Dimensional Array - C Array

C examples for Array:Multidimensional Arrays

Description

Retrieve the Addresses of Elements in a Two-Dimensional Array

Demo Code

#include <stdio.h>

int main(){//from  ww  w.  jav a 2  s.c  o m
     int r, c;
     int num[3][2] = {
                       {1, 4},
                       {2, 5},
                       {3, 6}
                     };
    
     for(r = 0; r < 3; r++) {
        for(c = 0; c < 2; c++){
            printf("Address of num[%d][%d]: %u \n", r, c, &num[r][c]);
        }
     }

     return(0);
}

Related Tutorials