Saturday, 25 July 2015

DIFFERENCE BETWEEN int *ptr[100] and int (*int)[100] and pointer to 2d and 3d array

int (*ptr) arr[1000] -     is a pointer to an array of 1000 elements  or 10000 is the size of the column and  rows can be dynamically created 

int  *arr[10000]   is an array of pointer contains 10000 pointers  or 10000 is the size of the row and column will be dynamically created 
 


declaring pointer to a 2d array 
 int arr[100][100]
 int (*ptr)[100]=arr;


ac-- value 2d array 
arr[i][j]=(*(arr+i))[j] or *((*arr+i)+j)
ex- 
arr[0][0]=(*(arr))[0] or *((*arr)+0)


No comments:

Post a Comment