Re: array pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 18 Jan 2011 14:32:43 +0100, ratheesh k <ratheesh.ksz@xxxxxxxxx> wrote:

int  *s_ptr;
int  **d_ptr;
int arr[2][2]={1,2,3,4};

One image is worth a thousand words, so here it goes:

arr is something like this in memory:

+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+

d_ptr would require something like:

+---------+---------+
| pointer | pointer |
+----|----+----|----+
     |         |     +---+---+
     |         +---> | 3 | 4 |
     |     +---+---+ +---+---+
     +---> | 1 | 2 |
           +---+---+

Ie. in arr all the numbers are lied linearly in memory whereas
int **d_ptr is an array of pointers to array of ints.
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux